You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(testing): add disableJestRuntime option to @nx/jest/plugin to speed up target inference (#28522)
This PR adds a new `disableJestRuntime` option to `@nx/jest/plugin`. By
setting this to `true`, the inference plugin will not use `jest-config`
and `jest-runtime` to retrieve `outputs`, nor matching spec files when
`ciTargetName` is used. Instead, we'll use our own config loader and
glob/matcher to get both values for the inferred targets.
This speeds up computation quite a bit. With a large monorepo (800
projects, 75K files), the computation goes from 2m 41s to 35s, or ~78%
time reduction.
NOTE: This has no effect on existing projects and needs to be opted
into.
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->
<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->
<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->
## Current Behavior
<!-- This is the behavior we have today -->
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes #
Copy file name to clipboardExpand all lines: docs/generated/packages/jest/documents/overview.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,16 @@ within the same workspace. In this case, you can configure the `@nx/jest/plugin`
60
60
"include": ["e2e/**/*"],
61
61
"options": {
62
62
"targetName": "e2e-local",
63
-
"ciTargetName": "e2e-ci"
63
+
"ciTargetName": "e2e-ci",
64
+
"disableJestRuntime": false
64
65
}
65
66
}
66
67
]
67
68
}
68
69
```
69
70
71
+
If you experience slowness from `@nx/jest/plugin`, then set `disableJestRuntime` to `true` to skip creating the Jest runtime. By disabling the Jest runtime, Nx will use its own utilities to find `inputs`, `outputs`, and test files for [Atomized targets](/ci/features/split-e2e-tasks). This can reduce computation time by as much as 80%.
72
+
70
73
### Splitting E2E Tests
71
74
72
75
If Jest is used to run E2E tests, you can enable [splitting the tasks](/ci/features/split-e2e-tasks) by file to get
Copy file name to clipboardExpand all lines: docs/shared/packages/jest/jest-plugin.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,16 @@ within the same workspace. In this case, you can configure the `@nx/jest/plugin`
60
60
"include": ["e2e/**/*"],
61
61
"options": {
62
62
"targetName": "e2e-local",
63
-
"ciTargetName": "e2e-ci"
63
+
"ciTargetName": "e2e-ci",
64
+
"disableJestRuntime": false
64
65
}
65
66
}
66
67
]
67
68
}
68
69
```
69
70
71
+
If you experience slowness from `@nx/jest/plugin`, then set `disableJestRuntime` to `true` to skip creating the Jest runtime. By disabling the Jest runtime, Nx will use its own utilities to find `inputs`, `outputs`, and test files for [Atomized targets](/ci/features/split-e2e-tasks). This can reduce computation time by as much as 80%.
72
+
70
73
### Splitting E2E Tests
71
74
72
75
If Jest is used to run E2E tests, you can enable [splitting the tasks](/ci/features/split-e2e-tasks) by file to get
0 commit comments