@naturalcycles/dev-lib 13.23.0 → 13.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/util/jest.util.js +10 -6
- package/package.json +1 -1
package/dist/util/jest.util.js
CHANGED
|
@@ -42,7 +42,7 @@ async function runJest(opt = {}) {
|
|
|
42
42
|
console.log((0, colors_1.dimGrey)(`node_modules/${(0, colors_1.white)('jest')} not found, skipping tests`));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const { CI, TZ = 'UTC', APP_ENV, JEST_NO_ALPHABETIC, JEST_SHARDS, NODE_OPTIONS = 'not defined', } = process.env;
|
|
45
|
+
const { CI, CIRCLECI, TZ = 'UTC', APP_ENV, JEST_NO_ALPHABETIC, JEST_SHARDS, NODE_OPTIONS = 'not defined', } = process.env;
|
|
46
46
|
const { node } = process.versions;
|
|
47
47
|
const { integration, manual, leaks } = opt;
|
|
48
48
|
const processArgs = process.argv.slice(2);
|
|
@@ -75,10 +75,14 @@ async function runJest(opt = {}) {
|
|
|
75
75
|
// Coverage only makes sense for unit tests, not for integration/manual
|
|
76
76
|
args.push('--coverage');
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
if (CIRCLECI) {
|
|
79
|
+
// We used to default to 2, but due to memory being an issue for Jest - now we default to 1,
|
|
80
|
+
// as it's the most memory-efficient way
|
|
81
|
+
// Since `workerIdleMemoryLimit` was introduced by default - we're changing default back to 2 workers
|
|
82
|
+
// We now only do it for CircleCI (not for CI in general), as it reports cpus as 36
|
|
83
|
+
// Github Actions don't do that and report correct number of cpus
|
|
84
|
+
maxWorkers ||= '--maxWorkers=2';
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
// Running all tests - will use `--silent` to suppress console-logs, will also set process.env.JEST_SILENT=1
|
|
84
88
|
if (CI || isRunningAllTests()) {
|
|
@@ -103,7 +107,7 @@ async function runJest(opt = {}) {
|
|
|
103
107
|
if (!JEST_NO_ALPHABETIC) {
|
|
104
108
|
args.push(`--testSequencer=${paths_cnst_1.cfgDir}/jest.alphabetic.sequencer.js`);
|
|
105
109
|
}
|
|
106
|
-
const par = os.availableParallelism();
|
|
110
|
+
const par = os.availableParallelism?.();
|
|
107
111
|
const cpus = os.cpus().length;
|
|
108
112
|
console.log(`${(0, colors_1.dimGrey)(`node ${node}, NODE_OPTIONS: ${NODE_OPTIONS}, cpus: ${cpus}, availableParallelism: ${par}`)}`);
|
|
109
113
|
if (JEST_SHARDS) {
|