Commit 2454848
fix(testing): remove --no-experimental-strip-types flag and add CJS migration
## Current Behavior
On Node.js v24+, the `@nx/jest/plugin` sets `--no-experimental-strip-types` in
NODE_OPTIONS which causes an error: "node: --no-experimental-strip-types is not
allowed in NODE_OPTIONS".
Additionally, `jest.config.ts` files using ESM syntax (`export default`,
`import`) fail to load correctly under Node.js type-stripping when the project
is configured for CommonJS.
## Expected Behavior
- Remove the NODE_OPTIONS manipulation that adds `--no-experimental-strip-types`
- Add a migration (22.2.0-beta.2) that converts `jest.config.ts` files from ESM
to CJS syntax for projects using `@nx/jest/plugin`
- The migration only runs when `@nx/jest/plugin` is registered in `nx.json`
- Projects with `type: module` are warned as they're incompatible with the plugin
- Files using ESM-only features (import.meta, top-level await) are skipped with
a warning for manual conversion
## Related Issue(s)
Fixes NXC-3541
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 7ff4f19 commit 2454848
File tree
4 files changed
+772
-15
lines changed- packages/jest
- src
- migrations/update-22-2-0
- plugins
4 files changed
+772
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
0 commit comments