@naturalcycles/dev-lib 13.24.0 → 13.25.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 +24 -10
- package/package.json +3 -3
package/dist/util/jest.util.js
CHANGED
|
@@ -42,8 +42,9 @@ 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, CIRCLECI, TZ = 'UTC', APP_ENV, JEST_NO_ALPHABETIC, JEST_SHARDS, NODE_OPTIONS = 'not defined', } = process.env;
|
|
45
|
+
const { CI, CIRCLECI, CPU_LIMIT, TZ = 'UTC', APP_ENV, JEST_NO_ALPHABETIC, JEST_SHARDS, NODE_OPTIONS = 'not defined', } = process.env;
|
|
46
46
|
const { node } = process.versions;
|
|
47
|
+
const cpuLimit = Number(CPU_LIMIT) || undefined;
|
|
47
48
|
const { integration, manual, leaks } = opt;
|
|
48
49
|
const processArgs = process.argv.slice(2);
|
|
49
50
|
let jestConfig;
|
|
@@ -75,13 +76,18 @@ async function runJest(opt = {}) {
|
|
|
75
76
|
// Coverage only makes sense for unit tests, not for integration/manual
|
|
76
77
|
args.push('--coverage');
|
|
77
78
|
}
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
if (!maxWorkers) {
|
|
80
|
+
if (cpuLimit && cpuLimit > 1) {
|
|
81
|
+
maxWorkers = `--maxWorkers=${cpuLimit - 1}`;
|
|
82
|
+
}
|
|
83
|
+
else if (CIRCLECI) {
|
|
84
|
+
// We used to default to 2, but due to memory being an issue for Jest - now we default to 1,
|
|
85
|
+
// as it's the most memory-efficient way
|
|
86
|
+
// Since `workerIdleMemoryLimit` was introduced by default - we're changing default back to 2 workers
|
|
87
|
+
// We now only do it for CircleCI (not for CI in general), as it reports cpus as 36
|
|
88
|
+
// Github Actions don't do that and report correct number of cpus
|
|
89
|
+
maxWorkers = '--maxWorkers=2';
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
// Running all tests - will use `--silent` to suppress console-logs, will also set process.env.JEST_SILENT=1
|
|
@@ -107,9 +113,17 @@ async function runJest(opt = {}) {
|
|
|
107
113
|
if (!JEST_NO_ALPHABETIC) {
|
|
108
114
|
args.push(`--testSequencer=${paths_cnst_1.cfgDir}/jest.alphabetic.sequencer.js`);
|
|
109
115
|
}
|
|
110
|
-
const
|
|
116
|
+
const availableParallelism = os.availableParallelism?.();
|
|
111
117
|
const cpus = os.cpus().length;
|
|
112
|
-
console.log(`${(0, colors_1.dimGrey)(
|
|
118
|
+
console.log(`${(0, colors_1.dimGrey)(Object.entries({
|
|
119
|
+
node,
|
|
120
|
+
NODE_OPTIONS,
|
|
121
|
+
cpus,
|
|
122
|
+
availableParallelism,
|
|
123
|
+
cpuLimit,
|
|
124
|
+
})
|
|
125
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
126
|
+
.join(', '))}`);
|
|
113
127
|
if (JEST_SHARDS) {
|
|
114
128
|
const totalShards = Number(JEST_SHARDS);
|
|
115
129
|
const shards = (0, js_lib_1._range)(1, totalShards + 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.25.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"tsn-debug": "tsn testScript.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"eslint-config-prettier": "^8.3.0",
|
|
45
45
|
"eslint-plugin-import": "^2.22.1",
|
|
46
46
|
"eslint-plugin-jest": "^27.0.1",
|
|
47
|
-
"eslint-plugin-jsdoc": "^
|
|
47
|
+
"eslint-plugin-jsdoc": "^41.1.1",
|
|
48
48
|
"eslint-plugin-unicorn": "^46.0.0",
|
|
49
49
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
50
50
|
"eslint-plugin-vue": "^9.0.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"jest": "^29.0.0",
|
|
66
66
|
"stylelint": "^15.0.0",
|
|
67
|
-
"stylelint-config-standard-scss": "^
|
|
67
|
+
"stylelint-config-standard-scss": "^8.0.0"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"dist",
|