Skip to content

Commit 2454848

Browse files
jaysooclaude
andcommitted
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

4 files changed

+772
-15
lines changed

packages/jest/migrations.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
},
3030
"description": "Replace removed matcher aliases in Jest v30 with their corresponding matcher",
3131
"implementation": "./src/migrations/update-21-3-0/replace-removed-matcher-aliases"
32+
},
33+
"convert-jest-config-to-cjs": {
34+
"version": "22.2.0-beta.2",
35+
"description": "Convert jest.config.ts files from ESM to CJS syntax (export default -> module.exports, import -> require) for projects using CommonJS resolution to ensure correct loading under Node.js type-stripping.",
36+
"implementation": "./src/migrations/update-22-2-0/convert-jest-config-to-cjs"
3237
}
3338
},
3439
"packageJsonUpdates": {

0 commit comments

Comments
 (0)