@knapsack-pro/jest 10.0.0 → 10.1.0
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/lib/knapsack-pro-jest.js +2 -1
- package/lib/utils.js +13 -0
- package/package.json +3 -3
package/lib/knapsack-pro-jest.js
CHANGED
|
@@ -6,7 +6,7 @@ import { relative } from 'path';
|
|
|
6
6
|
import { EnvConfig } from './env-config.js';
|
|
7
7
|
import { PathsFinder } from './paths-finder.js';
|
|
8
8
|
import { JestCLI } from './jest-cli.js';
|
|
9
|
-
import { normalizePaths } from './utils.js';
|
|
9
|
+
import { extractFailedSnapshotPaths, normalizePaths } from './utils.js';
|
|
10
10
|
const jestImport = await import('jest');
|
|
11
11
|
const jest = jestImport.default ?? jestImport;
|
|
12
12
|
const jestCLIOptions = JestCLI.argvToOptions();
|
|
@@ -38,6 +38,7 @@ const onSuccess = async (scheduledPaths) => {
|
|
|
38
38
|
failedPaths.add(path);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
+
extractFailedSnapshotPaths(results.snapshot, projectPath).forEach((path) => failedPaths.add(path));
|
|
41
42
|
return {
|
|
42
43
|
recordedPaths: normalizePaths(scheduledPaths, recordedPaths),
|
|
43
44
|
isTestSuiteGreen: results.success,
|
package/lib/utils.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { relative } from 'path';
|
|
2
|
+
export const extractFailedSnapshotPaths = (snapshot, projectPath) => {
|
|
3
|
+
const failedPaths = new Set();
|
|
4
|
+
if (snapshot.failure) {
|
|
5
|
+
snapshot.uncheckedKeysByFile.forEach(({ filePath }) => {
|
|
6
|
+
const path = process.platform === 'win32'
|
|
7
|
+
? relative(projectPath, filePath).replace(/\\/g, '/')
|
|
8
|
+
: relative(projectPath, filePath);
|
|
9
|
+
failedPaths.add(path);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return failedPaths;
|
|
13
|
+
};
|
|
1
14
|
export const normalizePaths = (scheduledPaths, recordedPaths) => {
|
|
2
15
|
return Object.entries(recordedPaths).reduce((acc, [path, time]) => {
|
|
3
16
|
return { ...acc, [path]: (acc[path] ?? 0) + time };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack-pro/jest",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Knapsack Pro Jest splits Jest tests across CI nodes and makes sure that tests will run in optimal time on each CI node.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"./package.json": "./package.json"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@knapsack-pro/core": "^11.
|
|
55
|
+
"@knapsack-pro/core": "^11.1.0",
|
|
56
56
|
"glob": "^13.0.6",
|
|
57
57
|
"minimatch": "^10.2.5",
|
|
58
58
|
"minimist": "^1.2.8",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@types/node": "^26.1.1",
|
|
67
67
|
"jest": "^30.4.2",
|
|
68
68
|
"typescript": "^7.0.2",
|
|
69
|
-
"vitest": "^
|
|
69
|
+
"vitest": "^5.0.1"
|
|
70
70
|
}
|
|
71
71
|
}
|