@nx/jest 22.7.1 → 22.7.3
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/migrations.json +28 -0
- package/package.json +6 -6
- package/preset/jest-preset.d.ts.map +1 -1
- package/preset/jest-preset.js +1 -0
- package/src/migrations/update-23-0-0/update-snapshot-guide-link.d.ts +3 -0
- package/src/migrations/update-23-0-0/update-snapshot-guide-link.d.ts.map +1 -0
- package/src/migrations/update-23-0-0/update-snapshot-guide-link.js +28 -0
- package/src/plugins/plugin.js +4 -3
- package/src/utils/config/get-jest-projects.js +2 -2
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +8 -3
package/migrations.json
CHANGED
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
},
|
|
43
43
|
"description": "Replace removed matcher aliases in Jest v30 with their corresponding matcher",
|
|
44
44
|
"implementation": "./src/migrations/update-21-3-0/replace-removed-matcher-aliases"
|
|
45
|
+
},
|
|
46
|
+
"update-snapshot-guide-link": {
|
|
47
|
+
"version": "23.0.0-beta.6",
|
|
48
|
+
"requires": {
|
|
49
|
+
"jest": ">=30.0.0"
|
|
50
|
+
},
|
|
51
|
+
"description": "Update the Jest snapshot guide link in `.snap` files from the legacy `https://goo.gl/fbAQLP` URL to `https://jestjs.io/docs/snapshot-testing`, which Jest v30 now requires.",
|
|
52
|
+
"implementation": "./src/migrations/update-23-0-0/update-snapshot-guide-link"
|
|
45
53
|
}
|
|
46
54
|
},
|
|
47
55
|
"packageJsonUpdates": {
|
|
@@ -171,6 +179,26 @@
|
|
|
171
179
|
"alwaysAddToPackageJson": false
|
|
172
180
|
}
|
|
173
181
|
}
|
|
182
|
+
},
|
|
183
|
+
"23.0.0-pin-jest-30-3-for-rn-compat": {
|
|
184
|
+
"version": "23.0.0-beta.9",
|
|
185
|
+
"requires": {
|
|
186
|
+
"jest": ">=30.0.0"
|
|
187
|
+
},
|
|
188
|
+
"packages": {
|
|
189
|
+
"jest": {
|
|
190
|
+
"version": "~30.3.0",
|
|
191
|
+
"alwaysAddToPackageJson": false
|
|
192
|
+
},
|
|
193
|
+
"babel-jest": {
|
|
194
|
+
"version": "~30.3.0",
|
|
195
|
+
"alwaysAddToPackageJson": false
|
|
196
|
+
},
|
|
197
|
+
"@types/jest": {
|
|
198
|
+
"version": "~30.0.0",
|
|
199
|
+
"alwaysAddToPackageJson": false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
174
202
|
}
|
|
175
203
|
}
|
|
176
204
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/jest",
|
|
3
|
-
"version": "22.7.
|
|
3
|
+
"version": "22.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@jest/reporters": "^30.0.2",
|
|
40
40
|
"@jest/test-result": "^30.0.2",
|
|
41
|
-
"@nx/devkit": "22.7.
|
|
42
|
-
"@nx/js": "22.7.
|
|
43
|
-
"@phenomnomnominal/tsquery": "~6.
|
|
41
|
+
"@nx/devkit": "22.7.3",
|
|
42
|
+
"@nx/js": "22.7.3",
|
|
43
|
+
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
44
44
|
"identity-obj-proxy": "3.0.0",
|
|
45
45
|
"jest-config": "^30.0.2",
|
|
46
46
|
"jest-resolve": "^30.0.2",
|
|
47
47
|
"jest-util": "^30.0.2",
|
|
48
|
-
"minimatch": "10.2.
|
|
48
|
+
"minimatch": "10.2.5",
|
|
49
49
|
"picocolors": "^1.1.0",
|
|
50
50
|
"resolve.exports": "2.0.3",
|
|
51
51
|
"semver": "^7.6.3",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"yargs-parser": "21.1.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"nx": "22.7.
|
|
56
|
+
"nx": "22.7.3"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-preset.d.ts","sourceRoot":"","sources":["../../../../packages/jest/preset/jest-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"jest-preset.d.ts","sourceRoot":"","sources":["../../../../packages/jest/preset/jest-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,MAuCtB,CAAC"}
|
package/preset/jest-preset.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.nxPreset = {
|
|
|
25
25
|
],
|
|
26
26
|
},
|
|
27
27
|
testEnvironment: 'jsdom',
|
|
28
|
+
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/out-tsc/'],
|
|
28
29
|
/**
|
|
29
30
|
* manually set the exports names to load in common js, to mimic the behaviors of jest 27
|
|
30
31
|
* before jest didn't fully support package exports and would load in common js code (typically via main field). now jest 28+ will load in the browser esm code, but jest esm support is not fully supported.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-snapshot-guide-link.d.ts","sourceRoot":"","sources":["../../../../../../packages/jest/src/migrations/update-23-0-0/update-snapshot-guide-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAM/D,wBAA8B,uBAAuB,CAAC,IAAI,EAAE,IAAI,iBA2B/D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = updateSnapshotGuideLink;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const OLD_HEADER = '// Jest Snapshot v1, https://goo.gl/fbAQLP';
|
|
6
|
+
const NEW_HEADER = '// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing';
|
|
7
|
+
async function updateSnapshotGuideLink(tree) {
|
|
8
|
+
const snapshotFiles = await (0, devkit_1.globAsync)(tree, ['**/__snapshots__/*.snap']);
|
|
9
|
+
for (const snapshotFile of snapshotFiles) {
|
|
10
|
+
const content = tree.read(snapshotFile, 'utf-8');
|
|
11
|
+
if (!content) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const newlineMatch = content.match(/\r?\n/);
|
|
15
|
+
if (!newlineMatch) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const newline = newlineMatch[0];
|
|
19
|
+
const firstNewlineIndex = content.indexOf(newline);
|
|
20
|
+
const firstLine = content.slice(0, firstNewlineIndex);
|
|
21
|
+
if (firstLine !== OLD_HEADER) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const updated = NEW_HEADER + content.slice(firstNewlineIndex);
|
|
25
|
+
tree.write(snapshotFile, updated);
|
|
26
|
+
}
|
|
27
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
28
|
+
}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -222,7 +222,6 @@ async function buildJestTargets(rawConfig, needsDtsInputs, configFilePath, proje
|
|
|
222
222
|
const targetName = `${options.ciTargetName}--${relativePath}`;
|
|
223
223
|
dependsOn.push({
|
|
224
224
|
target: targetName,
|
|
225
|
-
projects: 'self',
|
|
226
225
|
params: 'forward',
|
|
227
226
|
options: 'forward',
|
|
228
227
|
});
|
|
@@ -303,7 +302,10 @@ async function buildJestTargets(rawConfig, needsDtsInputs, configFilePath, proje
|
|
|
303
302
|
? await source.getTestPaths(config.globalConfig, config.projectConfig)
|
|
304
303
|
: // @ts-expect-error Jest v29 doesn't have the projectConfig parameter
|
|
305
304
|
await source.getTestPaths(config.globalConfig);
|
|
306
|
-
|
|
305
|
+
// Sort to keep atomized target name insertion order stable.
|
|
306
|
+
// jest.SearchSource.getTestPaths walks via jest-haste-map's
|
|
307
|
+
// parallel workers, so its output order isn't guaranteed.
|
|
308
|
+
const testPaths = new Set(specs.tests.map(({ path }) => path).sort());
|
|
307
309
|
if (testPaths.size > 0) {
|
|
308
310
|
const targetGroup = [];
|
|
309
311
|
metadata = {
|
|
@@ -326,7 +328,6 @@ async function buildJestTargets(rawConfig, needsDtsInputs, configFilePath, proje
|
|
|
326
328
|
const targetName = `${options.ciTargetName}--${relativePath}`;
|
|
327
329
|
dependsOn.push({
|
|
328
330
|
target: targetName,
|
|
329
|
-
projects: 'self',
|
|
330
331
|
params: 'forward',
|
|
331
332
|
options: 'forward',
|
|
332
333
|
});
|
|
@@ -4,7 +4,7 @@ exports.getJestProjectsAsync = getJestProjectsAsync;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
7
|
+
const yargs_parser_1 = tslib_1.__importDefault(require("yargs-parser"));
|
|
8
8
|
function getJestConfigProjectPath(projectJestConfigPath) {
|
|
9
9
|
return (0, path_1.join)('<rootDir>', projectJestConfigPath);
|
|
10
10
|
}
|
|
@@ -98,7 +98,7 @@ function collectJestConfigFromCommand(command, cwd, jestConfigurations) {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
for (const match of matches) {
|
|
101
|
-
const parsed =
|
|
101
|
+
const parsed = (0, yargs_parser_1.default)(match, {
|
|
102
102
|
configuration: { 'strip-dashed': true },
|
|
103
103
|
string: ['config'],
|
|
104
104
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/utils/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/utils/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAU5E,eAAO,MAAM,cAAc;;;;;;;;;;CAU1B,CAAC;AAEF,QAAA,MAAM,sBAAsB,mBAAoB,CAAC;AAIjD,KAAK,iBAAiB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,KAAK,mBAAmB,GAAG,MAAM,OAAO,cAAc,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG;KACtB,GAAG,IAAI,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC;CAChE,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAaxB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,OAiBlC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAclE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG;IACxD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAMA;AAED,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAIvE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAc9D"}
|
package/src/utils/versions.js
CHANGED
|
@@ -9,11 +9,16 @@ exports.validateInstalledJestVersion = validateInstalledJestVersion;
|
|
|
9
9
|
const devkit_1 = require("@nx/devkit");
|
|
10
10
|
const semver_1 = require("semver");
|
|
11
11
|
const nxVersion = require('../../package.json').version;
|
|
12
|
+
// Jest is pinned to 30.3.x because jest-runtime@30.4.0 added a call to
|
|
13
|
+
// `_moduleMocker.clearMocksOnScope()`, which doesn't exist on the
|
|
14
|
+
// jest-mock@29 ModuleMocker that React Native's preset still feeds in
|
|
15
|
+
// (via `@react-native/jest-preset`'s pinned `jest-environment-node@^29.7.0`).
|
|
16
|
+
// Lift this once Meta ships a Jest-30-aware preset on react-native.
|
|
12
17
|
exports.latestVersions = {
|
|
13
18
|
nxVersion,
|
|
14
|
-
jestVersion: '
|
|
15
|
-
babelJestVersion: '
|
|
16
|
-
jestTypesVersion: '
|
|
19
|
+
jestVersion: '~30.3.0',
|
|
20
|
+
babelJestVersion: '~30.3.0',
|
|
21
|
+
jestTypesVersion: '~30.0.0',
|
|
17
22
|
tsJestVersion: '^29.4.0',
|
|
18
23
|
tslibVersion: '^2.3.0',
|
|
19
24
|
swcJestVersion: '~0.2.38',
|