@nx/jest 22.7.0-beta.1 → 22.7.0-beta.11
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/package.json +7 -8
- package/src/executors/jest/jest.impl.js +3 -2
- package/src/executors/jest/schema.json +222 -222
- package/src/executors/jest/summary.js +2 -1
- package/src/generators/configuration/schema.json +87 -87
- package/src/generators/convert-to-inferred/schema.json +16 -16
- package/src/generators/init/schema.json +32 -32
- package/src/migrations/update-21-3-0/replace-removed-matcher-aliases.d.ts.map +1 -1
- package/src/migrations/update-21-3-0/replace-removed-matcher-aliases.js +46 -8
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +3 -3
- package/src/utils/config/get-jest-projects.js +2 -1
- package/project.json +0 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/jest",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.11",
|
|
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": {
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"Testing"
|
|
22
22
|
],
|
|
23
23
|
"main": "./index.js",
|
|
24
|
-
"
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"types": "./index.d.ts",
|
|
25
26
|
"author": "Victor Savkin",
|
|
26
27
|
"license": "MIT",
|
|
27
28
|
"bugs": {
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@jest/reporters": "^30.0.2",
|
|
39
40
|
"@jest/test-result": "^30.0.2",
|
|
40
|
-
"@nx/devkit": "22.7.0-beta.
|
|
41
|
-
"@nx/js": "22.7.0-beta.
|
|
41
|
+
"@nx/devkit": "22.7.0-beta.11",
|
|
42
|
+
"@nx/js": "22.7.0-beta.11",
|
|
42
43
|
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
43
44
|
"identity-obj-proxy": "3.0.0",
|
|
44
45
|
"jest-config": "^30.0.2",
|
|
@@ -52,11 +53,9 @@
|
|
|
52
53
|
"yargs-parser": "21.1.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"nx": "22.7.0-beta.
|
|
56
|
+
"nx": "22.7.0-beta.11"
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
59
|
-
}
|
|
60
|
-
"types": "./index.d.ts",
|
|
61
|
-
"type": "commonjs"
|
|
60
|
+
}
|
|
62
61
|
}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.jestExecutor = jestExecutor;
|
|
4
4
|
exports.parseJestConfig = parseJestConfig;
|
|
5
5
|
exports.batchJest = batchJest;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const jest_1 = require("jest");
|
|
7
8
|
const jest_config_1 = require("jest-config");
|
|
8
9
|
const reporters_1 = require("@jest/reporters");
|
|
9
10
|
const test_result_1 = require("@jest/test-result");
|
|
10
|
-
const path = require("path");
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
11
12
|
const path_1 = require("path");
|
|
12
13
|
const devkit_1 = require("@nx/devkit");
|
|
13
14
|
const summary_1 = require("./summary");
|
|
@@ -41,7 +42,7 @@ async function parseJestConfig(options, context, multiProjects = false) {
|
|
|
41
42
|
let jestConfig;
|
|
42
43
|
// support passing extra args to jest cli supporting 3rd party plugins
|
|
43
44
|
// like 'jest-runner-groups' --group arg
|
|
44
|
-
const schema = await Promise.resolve().then(() => require('./schema.json'));
|
|
45
|
+
const schema = await Promise.resolve().then(() => tslib_1.__importStar(require('./schema.json')));
|
|
45
46
|
const extraArgs = getExtraArgs(options, schema);
|
|
46
47
|
const config = {
|
|
47
48
|
...extraArgs,
|
|
@@ -1,231 +1,231 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
"name": "Pass Without Tests",
|
|
11
|
-
"keys": ["jestConfig", "passWithNoTests"]
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"name": "Code Coverage",
|
|
15
|
-
"keys": ["jestConfig", "coverageReporters"]
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"name": "Stop After 'n' Failed",
|
|
19
|
-
"keys": ["jestConfig", "bail"]
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"properties": {
|
|
23
|
-
"codeCoverage": {
|
|
24
|
-
"description": "Indicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/cli#--coverageboolean)",
|
|
25
|
-
"type": "boolean",
|
|
26
|
-
"aliases": ["coverage"]
|
|
27
|
-
},
|
|
28
|
-
"config": {
|
|
29
|
-
"description": "The path to a Jest config file specifying how to find and execute tests. If no `rootDir` is set in the config, the directory containing the config file is assumed to be the `rootDir` for the project. This can also be a JSON-encoded value which Jest will use as configuration.",
|
|
30
|
-
"type": "string"
|
|
31
|
-
},
|
|
32
|
-
"clearCache": {
|
|
33
|
-
"description": "Deletes the Jest cache directory and then exits without running tests. Will delete Jest's default cache directory. _Note: clearing the cache will reduce performance_.",
|
|
34
|
-
"type": "boolean"
|
|
35
|
-
},
|
|
36
|
-
"detectOpenHandles": {
|
|
37
|
-
"description": "Attempt to collect and print open handles preventing Jest from exiting cleanly (https://jestjs.io/docs/cli#--detectopenhandles)",
|
|
38
|
-
"type": "boolean"
|
|
39
|
-
},
|
|
40
|
-
"logHeapUsage": {
|
|
41
|
-
"description": "Logs the heap usage after every test. Useful to debug memory leaks. Use together with --runInBand and --expose-gc in node.",
|
|
42
|
-
"type": "boolean"
|
|
43
|
-
},
|
|
44
|
-
"detectLeaks": {
|
|
45
|
-
"description": "**EXPERIMENTAL**: Detect memory leaks in tests. After executing a test, it will try to garbage collect the global object used, and fail if it was leaked",
|
|
46
|
-
"type": "boolean"
|
|
47
|
-
},
|
|
48
|
-
"jestConfig": {
|
|
49
|
-
"description": "The path of the Jest configuration. (https://jestjs.io/docs/en/configuration)",
|
|
50
|
-
"type": "string",
|
|
51
|
-
"x-completion-type": "file",
|
|
52
|
-
"x-completion-glob": "jest.config@(.js|.ts)"
|
|
53
|
-
},
|
|
54
|
-
"testFile": {
|
|
55
|
-
"description": "The name of the file to test.",
|
|
56
|
-
"type": "string",
|
|
57
|
-
"$default": {
|
|
58
|
-
"$source": "argv",
|
|
59
|
-
"index": 0
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"tsConfig": {
|
|
63
|
-
"description": "The path to the TypeScript configuration file, relative to the workspace root. Note this is only metadata used by Angular migrations. This executor does not use it.",
|
|
64
|
-
"type": "string",
|
|
65
|
-
"x-completion-type": "file",
|
|
66
|
-
"x-completion-glob": "tsconfig.*.json"
|
|
67
|
-
},
|
|
68
|
-
"setupFile": {
|
|
69
|
-
"description": "The name of a setup file used by Jest.",
|
|
70
|
-
"type": "string",
|
|
71
|
-
"x-deprecated": "Use the `setupFilesAfterEnv` option in the Jest configuration file instead. See https://jestjs.io/docs/configuration#setupfilesafterenv-array. It will be removed in Nx v22."
|
|
72
|
-
},
|
|
73
|
-
"bail": {
|
|
74
|
-
"alias": "b",
|
|
75
|
-
"description": "Exit the test suite immediately after `n` number of failing tests. (https://jestjs.io/docs/cli#--bail)",
|
|
76
|
-
"oneOf": [
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "Jest Builder",
|
|
5
|
+
"description": "Jest target options for Build Facade.",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"presets": [
|
|
77
9
|
{
|
|
78
|
-
|
|
10
|
+
"name": "Pass Without Tests",
|
|
11
|
+
"keys": ["jestConfig", "passWithNoTests"]
|
|
79
12
|
},
|
|
80
13
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
"ci": {
|
|
86
|
-
"description": "Whether to run Jest in continuous integration (CI) mode. This option is on by default in most popular CI environments. It will prevent snapshots from being written unless explicitly requested. (https://jestjs.io/docs/cli#--ci)",
|
|
87
|
-
"type": "boolean"
|
|
88
|
-
},
|
|
89
|
-
"color": {
|
|
90
|
-
"alias": "colors",
|
|
91
|
-
"description": "Forces test results output color highlighting (even if `stdout` is not a TTY). Set to false if you would like to have no colors. (https://jestjs.io/docs/cli#--colors)",
|
|
92
|
-
"type": "boolean"
|
|
93
|
-
},
|
|
94
|
-
"findRelatedTests": {
|
|
95
|
-
"description": "Find and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles)",
|
|
96
|
-
"type": "string"
|
|
97
|
-
},
|
|
98
|
-
"forceExit": {
|
|
99
|
-
"description": "Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up.This feature is an escape-hatch. If Jest doesn't exit at the end of a test run, it means external resources are still being held on to or timers are still pending in your code. It is advised to tear down external resources after each test to make sure Jest can shut down cleanly. You can use --detectOpenHandles to help track it down.",
|
|
100
|
-
"type": "boolean"
|
|
101
|
-
},
|
|
102
|
-
"json": {
|
|
103
|
-
"description": "Prints the test results in `JSON`. This mode will send all other test output and user messages to `stderr`. (https://jestjs.io/docs/cli#--json)",
|
|
104
|
-
"type": "boolean"
|
|
105
|
-
},
|
|
106
|
-
"maxWorkers": {
|
|
107
|
-
"alias": "w",
|
|
108
|
-
"description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/cli#--maxworkersnumstring)",
|
|
109
|
-
"oneOf": [
|
|
110
|
-
{
|
|
111
|
-
"type": "number"
|
|
14
|
+
"name": "Code Coverage",
|
|
15
|
+
"keys": ["jestConfig", "coverageReporters"]
|
|
112
16
|
},
|
|
113
17
|
{
|
|
114
|
-
|
|
18
|
+
"name": "Stop After 'n' Failed",
|
|
19
|
+
"keys": ["jestConfig", "bail"]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"codeCoverage": {
|
|
24
|
+
"description": "Indicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/cli#--coverageboolean)",
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"aliases": ["coverage"]
|
|
27
|
+
},
|
|
28
|
+
"config": {
|
|
29
|
+
"description": "The path to a Jest config file specifying how to find and execute tests. If no `rootDir` is set in the config, the directory containing the config file is assumed to be the `rootDir` for the project. This can also be a JSON-encoded value which Jest will use as configuration.",
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"clearCache": {
|
|
33
|
+
"description": "Deletes the Jest cache directory and then exits without running tests. Will delete Jest's default cache directory. _Note: clearing the cache will reduce performance_.",
|
|
34
|
+
"type": "boolean"
|
|
35
|
+
},
|
|
36
|
+
"detectOpenHandles": {
|
|
37
|
+
"description": "Attempt to collect and print open handles preventing Jest from exiting cleanly (https://jestjs.io/docs/cli#--detectopenhandles)",
|
|
38
|
+
"type": "boolean"
|
|
39
|
+
},
|
|
40
|
+
"logHeapUsage": {
|
|
41
|
+
"description": "Logs the heap usage after every test. Useful to debug memory leaks. Use together with --runInBand and --expose-gc in node.",
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
"detectLeaks": {
|
|
45
|
+
"description": "**EXPERIMENTAL**: Detect memory leaks in tests. After executing a test, it will try to garbage collect the global object used, and fail if it was leaked",
|
|
46
|
+
"type": "boolean"
|
|
47
|
+
},
|
|
48
|
+
"jestConfig": {
|
|
49
|
+
"description": "The path of the Jest configuration. (https://jestjs.io/docs/en/configuration)",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"x-completion-type": "file",
|
|
52
|
+
"x-completion-glob": "jest.config@(.js|.ts)"
|
|
53
|
+
},
|
|
54
|
+
"testFile": {
|
|
55
|
+
"description": "The name of the file to test.",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"$default": {
|
|
58
|
+
"$source": "argv",
|
|
59
|
+
"index": 0
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"tsConfig": {
|
|
63
|
+
"description": "The path to the TypeScript configuration file, relative to the workspace root. Note this is only metadata used by Angular migrations. This executor does not use it.",
|
|
64
|
+
"type": "string",
|
|
65
|
+
"x-completion-type": "file",
|
|
66
|
+
"x-completion-glob": "tsconfig.*.json"
|
|
67
|
+
},
|
|
68
|
+
"setupFile": {
|
|
69
|
+
"description": "The name of a setup file used by Jest.",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"x-deprecated": "Use the `setupFilesAfterEnv` option in the Jest configuration file instead. See https://jestjs.io/docs/configuration#setupfilesafterenv-array. It will be removed in Nx v22."
|
|
72
|
+
},
|
|
73
|
+
"bail": {
|
|
74
|
+
"alias": "b",
|
|
75
|
+
"description": "Exit the test suite immediately after `n` number of failing tests. (https://jestjs.io/docs/cli#--bail)",
|
|
76
|
+
"oneOf": [
|
|
77
|
+
{
|
|
78
|
+
"type": "number"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "boolean"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"ci": {
|
|
86
|
+
"description": "Whether to run Jest in continuous integration (CI) mode. This option is on by default in most popular CI environments. It will prevent snapshots from being written unless explicitly requested. (https://jestjs.io/docs/cli#--ci)",
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
},
|
|
89
|
+
"color": {
|
|
90
|
+
"alias": "colors",
|
|
91
|
+
"description": "Forces test results output color highlighting (even if `stdout` is not a TTY). Set to false if you would like to have no colors. (https://jestjs.io/docs/cli#--colors)",
|
|
92
|
+
"type": "boolean"
|
|
93
|
+
},
|
|
94
|
+
"findRelatedTests": {
|
|
95
|
+
"description": "Find and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles)",
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"forceExit": {
|
|
99
|
+
"description": "Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up.This feature is an escape-hatch. If Jest doesn't exit at the end of a test run, it means external resources are still being held on to or timers are still pending in your code. It is advised to tear down external resources after each test to make sure Jest can shut down cleanly. You can use --detectOpenHandles to help track it down.",
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
"json": {
|
|
103
|
+
"description": "Prints the test results in `JSON`. This mode will send all other test output and user messages to `stderr`. (https://jestjs.io/docs/cli#--json)",
|
|
104
|
+
"type": "boolean"
|
|
105
|
+
},
|
|
106
|
+
"maxWorkers": {
|
|
107
|
+
"alias": "w",
|
|
108
|
+
"description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/cli#--maxworkersnumstring)",
|
|
109
|
+
"oneOf": [
|
|
110
|
+
{
|
|
111
|
+
"type": "number"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"type": "string"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"onlyChanged": {
|
|
119
|
+
"alias": "o",
|
|
120
|
+
"description": "Attempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a `git` or `hg` repository at the moment. (https://jestjs.io/docs/cli#--onlychanged)",
|
|
121
|
+
"type": "boolean"
|
|
122
|
+
},
|
|
123
|
+
"changedSince": {
|
|
124
|
+
"description": "Runs tests related to the changes since the provided branch or commit hash. If the current branch has diverged from the given branch, then only changes made locally will be tested. (https://jestjs.io/docs/cli#--changedsince)",
|
|
125
|
+
"type": "string"
|
|
126
|
+
},
|
|
127
|
+
"outputFile": {
|
|
128
|
+
"description": "Write test results to a file when the `--json` option is also specified. (https://jestjs.io/docs/cli#--outputfilefilename)",
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"passWithNoTests": {
|
|
132
|
+
"description": "Will not fail if no tests are found (for example while using `--testPathPatterns`.) (https://jestjs.io/docs/cli#--passwithnotests)",
|
|
133
|
+
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"randomize": {
|
|
136
|
+
"description": "Shuffle the order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
|
|
137
|
+
"type": "boolean"
|
|
138
|
+
},
|
|
139
|
+
"runInBand": {
|
|
140
|
+
"alias": "i",
|
|
141
|
+
"description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/cli#--runinband)",
|
|
142
|
+
"type": "boolean"
|
|
143
|
+
},
|
|
144
|
+
"showConfig": {
|
|
145
|
+
"description": "Print your Jest config and then exits. (https://jestjs.io/docs/en/cli#--showconfig)",
|
|
146
|
+
"type": "boolean"
|
|
147
|
+
},
|
|
148
|
+
"silent": {
|
|
149
|
+
"description": "Prevent tests from printing messages through the console. (https://jestjs.io/docs/cli#--silent)",
|
|
150
|
+
"type": "boolean"
|
|
151
|
+
},
|
|
152
|
+
"testNamePattern": {
|
|
153
|
+
"alias": "t",
|
|
154
|
+
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex)",
|
|
155
|
+
"type": "string"
|
|
156
|
+
},
|
|
157
|
+
"testPathIgnorePatterns": {
|
|
158
|
+
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray)",
|
|
159
|
+
"type": "array",
|
|
160
|
+
"items": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"testPathPatterns": {
|
|
165
|
+
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. (https://jestjs.io/docs/cli#--testpathpatternsregex)",
|
|
166
|
+
"type": "array",
|
|
167
|
+
"items": {
|
|
168
|
+
"type": "string"
|
|
169
|
+
},
|
|
170
|
+
"default": []
|
|
171
|
+
},
|
|
172
|
+
"colors": {
|
|
173
|
+
"description": "Forces test results output highlighting even if stdout is not a TTY. (https://jestjs.io/docs/cli#--colors)",
|
|
174
|
+
"type": "boolean"
|
|
175
|
+
},
|
|
176
|
+
"reporters": {
|
|
177
|
+
"description": "Run tests with specified reporters. Reporter options are not available via CLI. Example with multiple reporters: `jest --reporters=\"default\" --reporters=\"jest-junit\"`. (https://jestjs.io/docs/cli#--reporters)",
|
|
178
|
+
"type": "array",
|
|
179
|
+
"items": {
|
|
180
|
+
"type": "string"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"verbose": {
|
|
184
|
+
"description": "Display individual test results with the test suite hierarchy. (https://jestjs.io/docs/cli#--verbose)",
|
|
185
|
+
"type": "boolean"
|
|
186
|
+
},
|
|
187
|
+
"coverageReporters": {
|
|
188
|
+
"description": "A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter.",
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"coverageDirectory": {
|
|
195
|
+
"description": "The directory where Jest should output its coverage files.",
|
|
196
|
+
"type": "string",
|
|
197
|
+
"x-completion-type": "directory"
|
|
198
|
+
},
|
|
199
|
+
"testResultsProcessor": {
|
|
200
|
+
"description": "Node module that implements a custom results processor. (https://jestjs.io/docs/en/configuration#testresultsprocessor-string)",
|
|
201
|
+
"type": "string"
|
|
202
|
+
},
|
|
203
|
+
"updateSnapshot": {
|
|
204
|
+
"alias": "u",
|
|
205
|
+
"description": "Use this flag to re-record snapshots. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshot for test matching the pattern. (https://jestjs.io/docs/cli#--updatesnapshot)",
|
|
206
|
+
"type": "boolean"
|
|
207
|
+
},
|
|
208
|
+
"useStderr": {
|
|
209
|
+
"description": "Divert all output to stderr.",
|
|
210
|
+
"type": "boolean"
|
|
211
|
+
},
|
|
212
|
+
"watch": {
|
|
213
|
+
"description": "Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option. (https://jestjs.io/docs/cli#--watch)",
|
|
214
|
+
"type": "boolean"
|
|
215
|
+
},
|
|
216
|
+
"watchAll": {
|
|
217
|
+
"description": "Watch files for changes and rerun all tests when something changes. If you want to re-run only the tests that depend on the changed files, use the `--watch` option. (https://jestjs.io/docs/cli#--watchall)",
|
|
218
|
+
"type": "boolean"
|
|
219
|
+
},
|
|
220
|
+
"testLocationInResults": {
|
|
221
|
+
"description": "Adds a location field to test results. Used to report location of a test in a reporter. { \"column\": 4, \"line\": 5 } (https://jestjs.io/docs/cli#--testlocationinresults)",
|
|
222
|
+
"type": "boolean"
|
|
223
|
+
},
|
|
224
|
+
"testTimeout": {
|
|
225
|
+
"description": "Default timeout of a test in milliseconds. Default value: `5000`. (https://jestjs.io/docs/cli#--testtimeoutnumber)",
|
|
226
|
+
"type": "number"
|
|
115
227
|
}
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
"onlyChanged": {
|
|
119
|
-
"alias": "o",
|
|
120
|
-
"description": "Attempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a `git` or `hg` repository at the moment. (https://jestjs.io/docs/cli#--onlychanged)",
|
|
121
|
-
"type": "boolean"
|
|
122
|
-
},
|
|
123
|
-
"changedSince": {
|
|
124
|
-
"description": "Runs tests related to the changes since the provided branch or commit hash. If the current branch has diverged from the given branch, then only changes made locally will be tested. (https://jestjs.io/docs/cli#--changedsince)",
|
|
125
|
-
"type": "string"
|
|
126
|
-
},
|
|
127
|
-
"outputFile": {
|
|
128
|
-
"description": "Write test results to a file when the `--json` option is also specified. (https://jestjs.io/docs/cli#--outputfilefilename)",
|
|
129
|
-
"type": "string"
|
|
130
|
-
},
|
|
131
|
-
"passWithNoTests": {
|
|
132
|
-
"description": "Will not fail if no tests are found (for example while using `--testPathPatterns`.) (https://jestjs.io/docs/cli#--passwithnotests)",
|
|
133
|
-
"type": "boolean"
|
|
134
|
-
},
|
|
135
|
-
"randomize": {
|
|
136
|
-
"description": "Shuffle the order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
|
|
137
|
-
"type": "boolean"
|
|
138
|
-
},
|
|
139
|
-
"runInBand": {
|
|
140
|
-
"alias": "i",
|
|
141
|
-
"description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/cli#--runinband)",
|
|
142
|
-
"type": "boolean"
|
|
143
|
-
},
|
|
144
|
-
"showConfig": {
|
|
145
|
-
"description": "Print your Jest config and then exits. (https://jestjs.io/docs/en/cli#--showconfig)",
|
|
146
|
-
"type": "boolean"
|
|
147
|
-
},
|
|
148
|
-
"silent": {
|
|
149
|
-
"description": "Prevent tests from printing messages through the console. (https://jestjs.io/docs/cli#--silent)",
|
|
150
|
-
"type": "boolean"
|
|
151
|
-
},
|
|
152
|
-
"testNamePattern": {
|
|
153
|
-
"alias": "t",
|
|
154
|
-
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex)",
|
|
155
|
-
"type": "string"
|
|
156
|
-
},
|
|
157
|
-
"testPathIgnorePatterns": {
|
|
158
|
-
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray)",
|
|
159
|
-
"type": "array",
|
|
160
|
-
"items": {
|
|
161
|
-
"type": "string"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"testPathPatterns": {
|
|
165
|
-
"description": "An array of regexp pattern strings that is matched against all tests paths before executing the test. (https://jestjs.io/docs/cli#--testpathpatternsregex)",
|
|
166
|
-
"type": "array",
|
|
167
|
-
"items": {
|
|
168
|
-
"type": "string"
|
|
169
|
-
},
|
|
170
|
-
"default": []
|
|
171
|
-
},
|
|
172
|
-
"colors": {
|
|
173
|
-
"description": "Forces test results output highlighting even if stdout is not a TTY. (https://jestjs.io/docs/cli#--colors)",
|
|
174
|
-
"type": "boolean"
|
|
175
|
-
},
|
|
176
|
-
"reporters": {
|
|
177
|
-
"description": "Run tests with specified reporters. Reporter options are not available via CLI. Example with multiple reporters: `jest --reporters=\"default\" --reporters=\"jest-junit\"`. (https://jestjs.io/docs/cli#--reporters)",
|
|
178
|
-
"type": "array",
|
|
179
|
-
"items": {
|
|
180
|
-
"type": "string"
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
"verbose": {
|
|
184
|
-
"description": "Display individual test results with the test suite hierarchy. (https://jestjs.io/docs/cli#--verbose)",
|
|
185
|
-
"type": "boolean"
|
|
186
|
-
},
|
|
187
|
-
"coverageReporters": {
|
|
188
|
-
"description": "A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter.",
|
|
189
|
-
"type": "array",
|
|
190
|
-
"items": {
|
|
191
|
-
"type": "string"
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"coverageDirectory": {
|
|
195
|
-
"description": "The directory where Jest should output its coverage files.",
|
|
196
|
-
"type": "string",
|
|
197
|
-
"x-completion-type": "directory"
|
|
198
|
-
},
|
|
199
|
-
"testResultsProcessor": {
|
|
200
|
-
"description": "Node module that implements a custom results processor. (https://jestjs.io/docs/en/configuration#testresultsprocessor-string)",
|
|
201
|
-
"type": "string"
|
|
202
|
-
},
|
|
203
|
-
"updateSnapshot": {
|
|
204
|
-
"alias": "u",
|
|
205
|
-
"description": "Use this flag to re-record snapshots. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshot for test matching the pattern. (https://jestjs.io/docs/cli#--updatesnapshot)",
|
|
206
|
-
"type": "boolean"
|
|
207
|
-
},
|
|
208
|
-
"useStderr": {
|
|
209
|
-
"description": "Divert all output to stderr.",
|
|
210
|
-
"type": "boolean"
|
|
211
|
-
},
|
|
212
|
-
"watch": {
|
|
213
|
-
"description": "Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option. (https://jestjs.io/docs/cli#--watch)",
|
|
214
|
-
"type": "boolean"
|
|
215
|
-
},
|
|
216
|
-
"watchAll": {
|
|
217
|
-
"description": "Watch files for changes and rerun all tests when something changes. If you want to re-run only the tests that depend on the changed files, use the `--watch` option. (https://jestjs.io/docs/cli#--watchall)",
|
|
218
|
-
"type": "boolean"
|
|
219
|
-
},
|
|
220
|
-
"testLocationInResults": {
|
|
221
|
-
"description": "Adds a location field to test results. Used to report location of a test in a reporter. { \"column\": 4, \"line\": 5 } (https://jestjs.io/docs/cli#--testlocationinresults)",
|
|
222
|
-
"type": "boolean"
|
|
223
228
|
},
|
|
224
|
-
"
|
|
225
|
-
|
|
226
|
-
"type": "number"
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"required": ["jestConfig"],
|
|
230
|
-
"examplesFile": "../../../docs/jest-examples.md"
|
|
229
|
+
"required": ["jestConfig"],
|
|
230
|
+
"examplesFile": "../../../docs/jest-examples.md"
|
|
231
231
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const jest_util_1 = require("jest-util");
|
|
5
|
-
const pc = require("picocolors");
|
|
6
|
+
const pc = tslib_1.__importStar(require("picocolors"));
|
|
6
7
|
/**
|
|
7
8
|
* Copied from the jest repo because these utility functions are not exposed through the package
|
|
8
9
|
* https://github.com/facebook/jest/blob/7a64ede2163eba4ecc725f448cd92102cd8c14aa/packages/jest-reporters/src/utils.ts
|
|
@@ -1,90 +1,90 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxJestProject",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Add Jest Configuration to a project",
|
|
6
|
+
"description": "Add Jest Configuration to a project.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"project": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The name of the project.",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "projectName"
|
|
14
|
+
},
|
|
15
|
+
"x-priority": "important"
|
|
16
|
+
},
|
|
17
|
+
"skipSetupFile": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Skips the setup file required for angular.",
|
|
20
|
+
"default": false,
|
|
21
|
+
"x-deprecated": "Use the `setupFile` option instead. It will be removed in Nx v22."
|
|
22
|
+
},
|
|
23
|
+
"setupFile": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": ["none", "angular", "web-components"],
|
|
26
|
+
"description": "The setup file to be generated.",
|
|
27
|
+
"default": "none",
|
|
28
|
+
"x-priority": "important"
|
|
29
|
+
},
|
|
30
|
+
"skipSerializers": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"description": "Skips the serializers required to snapshot angular templates.",
|
|
33
|
+
"default": false
|
|
34
|
+
},
|
|
35
|
+
"supportTsx": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"description": "Setup `tsx` support.",
|
|
38
|
+
"default": false,
|
|
39
|
+
"x-priority": "important"
|
|
40
|
+
},
|
|
41
|
+
"testEnvironment": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["jsdom", "node", "none"],
|
|
44
|
+
"description": "The test environment for jest.",
|
|
45
|
+
"default": "jsdom",
|
|
46
|
+
"x-priority": "important"
|
|
47
|
+
},
|
|
48
|
+
"compiler": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["tsc", "babel", "swc"],
|
|
51
|
+
"description": "The compiler to use for source and tests.",
|
|
52
|
+
"default": "tsc"
|
|
53
|
+
},
|
|
54
|
+
"babelJest": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"alias": "babel-jest",
|
|
57
|
+
"description": "Use `babel-jest` instead of `ts-jest`.",
|
|
58
|
+
"x-deprecated": "Use the `compiler` option instead. It will be removed in Nx v22.",
|
|
59
|
+
"default": false
|
|
60
|
+
},
|
|
61
|
+
"skipFormat": {
|
|
62
|
+
"description": "Skip formatting files",
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"default": false,
|
|
65
|
+
"x-priority": "internal"
|
|
66
|
+
},
|
|
67
|
+
"skipPackageJson": {
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"default": false,
|
|
70
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
71
|
+
"x-priority": "internal"
|
|
72
|
+
},
|
|
73
|
+
"js": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"default": false,
|
|
76
|
+
"description": "Use JavaScript instead of TypeScript for config files"
|
|
77
|
+
},
|
|
78
|
+
"runtimeTsconfigFileName": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"description": "The name of the project's tsconfig file that includes the runtime source files. If not provided, it will default to `tsconfig.lib.json` for libraries and `tsconfig.app.json` for applications."
|
|
81
|
+
},
|
|
82
|
+
"keepExistingVersions": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"x-priority": "internal",
|
|
85
|
+
"description": "Keep existing dependencies versions",
|
|
86
|
+
"default": true
|
|
87
|
+
}
|
|
16
88
|
},
|
|
17
|
-
"
|
|
18
|
-
"type": "boolean",
|
|
19
|
-
"description": "Skips the setup file required for angular.",
|
|
20
|
-
"default": false,
|
|
21
|
-
"x-deprecated": "Use the `setupFile` option instead. It will be removed in Nx v22."
|
|
22
|
-
},
|
|
23
|
-
"setupFile": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"enum": ["none", "angular", "web-components"],
|
|
26
|
-
"description": "The setup file to be generated.",
|
|
27
|
-
"default": "none",
|
|
28
|
-
"x-priority": "important"
|
|
29
|
-
},
|
|
30
|
-
"skipSerializers": {
|
|
31
|
-
"type": "boolean",
|
|
32
|
-
"description": "Skips the serializers required to snapshot angular templates.",
|
|
33
|
-
"default": false
|
|
34
|
-
},
|
|
35
|
-
"supportTsx": {
|
|
36
|
-
"type": "boolean",
|
|
37
|
-
"description": "Setup `tsx` support.",
|
|
38
|
-
"default": false,
|
|
39
|
-
"x-priority": "important"
|
|
40
|
-
},
|
|
41
|
-
"testEnvironment": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"enum": ["jsdom", "node", "none"],
|
|
44
|
-
"description": "The test environment for jest.",
|
|
45
|
-
"default": "jsdom",
|
|
46
|
-
"x-priority": "important"
|
|
47
|
-
},
|
|
48
|
-
"compiler": {
|
|
49
|
-
"type": "string",
|
|
50
|
-
"enum": ["tsc", "babel", "swc"],
|
|
51
|
-
"description": "The compiler to use for source and tests.",
|
|
52
|
-
"default": "tsc"
|
|
53
|
-
},
|
|
54
|
-
"babelJest": {
|
|
55
|
-
"type": "boolean",
|
|
56
|
-
"alias": "babel-jest",
|
|
57
|
-
"description": "Use `babel-jest` instead of `ts-jest`.",
|
|
58
|
-
"x-deprecated": "Use the `compiler` option instead. It will be removed in Nx v22.",
|
|
59
|
-
"default": false
|
|
60
|
-
},
|
|
61
|
-
"skipFormat": {
|
|
62
|
-
"description": "Skip formatting files",
|
|
63
|
-
"type": "boolean",
|
|
64
|
-
"default": false,
|
|
65
|
-
"x-priority": "internal"
|
|
66
|
-
},
|
|
67
|
-
"skipPackageJson": {
|
|
68
|
-
"type": "boolean",
|
|
69
|
-
"default": false,
|
|
70
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
71
|
-
"x-priority": "internal"
|
|
72
|
-
},
|
|
73
|
-
"js": {
|
|
74
|
-
"type": "boolean",
|
|
75
|
-
"default": false,
|
|
76
|
-
"description": "Use JavaScript instead of TypeScript for config files"
|
|
77
|
-
},
|
|
78
|
-
"runtimeTsconfigFileName": {
|
|
79
|
-
"type": "string",
|
|
80
|
-
"description": "The name of the project's tsconfig file that includes the runtime source files. If not provided, it will default to `tsconfig.lib.json` for libraries and `tsconfig.app.json` for applications."
|
|
81
|
-
},
|
|
82
|
-
"keepExistingVersions": {
|
|
83
|
-
"type": "boolean",
|
|
84
|
-
"x-priority": "internal",
|
|
85
|
-
"description": "Keep existing dependencies versions",
|
|
86
|
-
"default": true
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"required": []
|
|
89
|
+
"required": []
|
|
90
90
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxJestConvertToInferred",
|
|
4
|
+
"description": "Convert existing Jest project(s) using `@nx/jest:jest` executor to use `@nx/jest/plugin`.",
|
|
5
|
+
"title": "Convert Jest project from executor to plugin",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"project": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The project to convert from using the `@nx/jest:jest` executor to use `@nx/jest/plugin`. If not provided, all projects using the `@nx/jest:jest` executor will be converted.",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"skipFormat": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "Whether to format files.",
|
|
16
|
+
"default": false
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
|
-
}
|
|
19
19
|
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxJestInit",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Jest init",
|
|
6
|
+
"description": "Add Jest Configuration to a workspace.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"skipFormat": {
|
|
10
|
+
"description": "Skip formatting files.",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": false,
|
|
13
|
+
"x-priority": "internal"
|
|
14
|
+
},
|
|
15
|
+
"skipPackageJson": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false,
|
|
18
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
19
|
+
"x-priority": "internal"
|
|
20
|
+
},
|
|
21
|
+
"keepExistingVersions": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"x-priority": "internal",
|
|
24
|
+
"description": "Keep existing dependencies versions",
|
|
25
|
+
"default": false
|
|
26
|
+
},
|
|
27
|
+
"updatePackageScripts": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"x-priority": "internal",
|
|
30
|
+
"description": "Update `package.json` scripts with inferred targets",
|
|
31
|
+
"default": false
|
|
32
|
+
}
|
|
14
33
|
},
|
|
15
|
-
"
|
|
16
|
-
"type": "boolean",
|
|
17
|
-
"default": false,
|
|
18
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
19
|
-
"x-priority": "internal"
|
|
20
|
-
},
|
|
21
|
-
"keepExistingVersions": {
|
|
22
|
-
"type": "boolean",
|
|
23
|
-
"x-priority": "internal",
|
|
24
|
-
"description": "Keep existing dependencies versions",
|
|
25
|
-
"default": false
|
|
26
|
-
},
|
|
27
|
-
"updatePackageScripts": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"x-priority": "internal",
|
|
30
|
-
"description": "Update `package.json` scripts with inferred targets",
|
|
31
|
-
"default": false
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"required": []
|
|
34
|
+
"required": []
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-removed-matcher-aliases.d.ts","sourceRoot":"","sources":["../../../../../../packages/jest/src/migrations/update-21-3-0/replace-removed-matcher-aliases.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"replace-removed-matcher-aliases.d.ts","sourceRoot":"","sources":["../../../../../../packages/jest/src/migrations/update-21-3-0/replace-removed-matcher-aliases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAuBvE,yBAA+B,IAAI,EAAE,IAAI,iBAWxC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
7
|
const jest_1 = require("jest");
|
|
7
8
|
const jest_config_1 = require("jest-config");
|
|
8
|
-
const jest_runtime_1 = require("jest-runtime");
|
|
9
|
+
const jest_runtime_1 = tslib_1.__importDefault(require("jest-runtime"));
|
|
9
10
|
const path_1 = require("path");
|
|
10
11
|
const matcherAliasesMap = new Map([
|
|
11
12
|
['toBeCalled', 'toHaveBeenCalled'],
|
|
@@ -85,16 +86,53 @@ async function getTestFilePaths(tree) {
|
|
|
85
86
|
// skip the root jest config file which includes all projects
|
|
86
87
|
continue;
|
|
87
88
|
}
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const resolvedPaths = await resolveTestPaths(tree, jestConfigFile);
|
|
90
|
+
if (resolvedPaths) {
|
|
91
|
+
for (const testPath of resolvedPaths) {
|
|
92
|
+
testFilePaths.add(testPath);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return Array.from(testFilePaths);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves test file paths for a single jest config by loading the config
|
|
100
|
+
* through Jest's own resolution. Returns null if the config cannot be
|
|
101
|
+
* resolved (e.g. missing files, uninstalled transform modules, invalid
|
|
102
|
+
* presets), logging a warning so the user knows which project was skipped.
|
|
103
|
+
*/
|
|
104
|
+
async function resolveTestPaths(tree, jestConfigFile) {
|
|
105
|
+
const fullConfigPath = (0, path_1.join)(tree.root, jestConfigFile);
|
|
106
|
+
let config;
|
|
107
|
+
try {
|
|
108
|
+
config = await (0, jest_config_1.readConfig)({ _: [], $0: undefined }, fullConfigPath);
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
112
|
+
devkit_1.logger.warn(`Could not read Jest config "${jestConfigFile}": ${message}. Skipping this project for matcher alias replacement.`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
let jestContext;
|
|
116
|
+
try {
|
|
117
|
+
jestContext = await jest_runtime_1.default.createContext(config.projectConfig, {
|
|
90
118
|
maxWorkers: 1,
|
|
91
119
|
watchman: false,
|
|
92
120
|
});
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
124
|
+
devkit_1.logger.warn(`Could not create Jest context for "${jestConfigFile}": ${message}. Skipping this project for matcher alias replacement.`);
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
let specs;
|
|
128
|
+
try {
|
|
93
129
|
const source = new jest_1.SearchSource(jestContext);
|
|
94
|
-
|
|
95
|
-
for (const testPath of specs.tests) {
|
|
96
|
-
testFilePaths.add(path_1.posix.normalize((0, path_1.relative)(tree.root, testPath.path)));
|
|
97
|
-
}
|
|
130
|
+
specs = await source.getTestPaths(config.globalConfig, config.projectConfig);
|
|
98
131
|
}
|
|
99
|
-
|
|
132
|
+
catch (e) {
|
|
133
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
134
|
+
devkit_1.logger.warn(`Could not resolve test paths for "${jestConfigFile}": ${message}. Skipping this project for matcher alias replacement.`);
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
return specs.tests.map((t) => path_1.posix.normalize((0, path_1.relative)(tree.root, t.path)));
|
|
100
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/jest/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAUd,MAAM,YAAY,CAAC;AA4BpB,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAmBD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAsFxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -16,7 +16,6 @@ const installation_directory_1 = require("nx/src/utils/installation-directory");
|
|
|
16
16
|
const plugins_1 = require("nx/src/utils/plugins");
|
|
17
17
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
18
18
|
const versions_1 = require("../utils/versions");
|
|
19
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
20
19
|
const REPORTER_BUILTINS = new Set(['default', 'github-actions', 'summary']);
|
|
21
20
|
function readTargetsCache(cachePath) {
|
|
22
21
|
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, node_fs_1.existsSync)(cachePath)
|
|
@@ -37,6 +36,7 @@ exports.createNodes = [
|
|
|
37
36
|
const presetCache = {};
|
|
38
37
|
const isInPackageManagerWorkspaces = buildPackageJsonWorkspacesMatcher(context.workspaceRoot);
|
|
39
38
|
options = normalizeOptions(options);
|
|
39
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
40
40
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFiles.reduce((acc, configFile) => {
|
|
41
41
|
const potentialRoot = (0, node_path_1.dirname)(configFile);
|
|
42
42
|
if (checkIfConfigFileShouldBeProject(configFile, potentialRoot, isInPackageManagerWorkspaces, context)) {
|
|
@@ -53,7 +53,7 @@ exports.createNodes = [
|
|
|
53
53
|
return await (0, devkit_1.createNodesFromFiles)(async (configFilePath, options, context, idx) => {
|
|
54
54
|
const projectRoot = projectRoots[idx];
|
|
55
55
|
const hash = hashes[idx];
|
|
56
|
-
targetsCache[hash] ??= await buildJestTargets(configFilePath, projectRoot, options, context, presetCache);
|
|
56
|
+
targetsCache[hash] ??= await buildJestTargets(configFilePath, projectRoot, options, context, presetCache, pmc);
|
|
57
57
|
const { targets, metadata } = targetsCache[hash];
|
|
58
58
|
return {
|
|
59
59
|
projects: {
|
|
@@ -103,7 +103,7 @@ function checkIfConfigFileShouldBeProject(configFilePath, projectRoot, isInPacka
|
|
|
103
103
|
}
|
|
104
104
|
return true;
|
|
105
105
|
}
|
|
106
|
-
async function buildJestTargets(configFilePath, projectRoot, options, context, presetCache) {
|
|
106
|
+
async function buildJestTargets(configFilePath, projectRoot, options, context, presetCache, pmc) {
|
|
107
107
|
const absConfigFilePath = (0, node_path_1.resolve)(context.workspaceRoot, configFilePath);
|
|
108
108
|
if (require.cache[absConfigFilePath])
|
|
109
109
|
(0, config_utils_1.clearRequireCache)();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getJestProjectsAsync = getJestProjectsAsync;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const path_1 = require("path");
|
|
6
|
-
const yargs = require("yargs-parser");
|
|
7
|
+
const yargs = tslib_1.__importStar(require("yargs-parser"));
|
|
7
8
|
function getJestConfigProjectPath(projectJestConfigPath) {
|
|
8
9
|
return (0, path_1.join)('<rootDir>', projectJestConfigPath);
|
|
9
10
|
}
|
package/project.json
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "jest",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/jest",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"outputs": ["{workspaceRoot}/dist/packages/jest/README.md"],
|
|
9
|
-
"command": "node ./scripts/copy-readme.js jest"
|
|
10
|
-
},
|
|
11
|
-
"legacy-post-build": {
|
|
12
|
-
"executor": "@nx/workspace-plugin:legacy-post-build",
|
|
13
|
-
"options": {
|
|
14
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
15
|
-
"assets": [
|
|
16
|
-
{
|
|
17
|
-
"input": "packages/jest",
|
|
18
|
-
"glob": "**/@(files|files-angular)/**",
|
|
19
|
-
"output": "/"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"input": "packages/jest",
|
|
23
|
-
"glob": "**/files/**/.gitkeep",
|
|
24
|
-
"output": "/"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"input": "packages/jest",
|
|
28
|
-
"glob": "**/*.json",
|
|
29
|
-
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
|
30
|
-
"output": "/"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"input": "packages/jest",
|
|
34
|
-
"glob": "**/*.js",
|
|
35
|
-
"ignore": ["**/jest.config.js"],
|
|
36
|
-
"output": "/"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"input": "packages/jest",
|
|
40
|
-
"glob": "**/*.d.ts",
|
|
41
|
-
"output": "/"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"input": "packages/jest",
|
|
45
|
-
"glob": "PLUGIN.md",
|
|
46
|
-
"output": "/"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"input": "",
|
|
50
|
-
"glob": "LICENSE",
|
|
51
|
-
"output": "/"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|