@nx/jest 23.1.0-beta.3 → 23.1.0-beta.4
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.
|
@@ -39,3 +39,13 @@ TypeScript 6 and above resolves `exports` under `bundler` with `commonjs`, so th
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
|
+
|
|
43
|
+
#### Verifying the workspace
|
|
44
|
+
|
|
45
|
+
After the migration runs, verify the workspace still typechecks and fix anything `isolatedModules` surfaced:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
nx run-many -t typecheck
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`isolatedModules` can fail typecheck (TS1205 - re-exporting a type needs `export type`; TS2748 - const enum access) or break a project's tests at runtime even when typecheck passes. The cause is a package that re-exports a value through both `module.exports` and an ESM `export` (for example napi bindings exposing a `const enum`); per-file transpilation cannot preserve it, and consumers of that const enum break too. To fix a broken project, remove `isolatedModules` from its `tsconfig.spec.json`; if that brings back the `TS2307: Cannot find module` error this migration was added to prevent, that project needs `isolatedModules`, so fix the source instead.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Verify typecheck after the Nx 23.1 migration
|
|
2
|
+
|
|
3
|
+
This migration enables `isolatedModules` on ts-jest spec configs. Run
|
|
4
|
+
`nx run-many -t typecheck` and fix any project it broke.
|
|
5
|
+
|
|
6
|
+
`isolatedModules` can fail typecheck (TS1205 - a re-exported type needs `export type`;
|
|
7
|
+
TS2748 - const enum access) or break a project's tests at runtime. To fix a broken
|
|
8
|
+
project, remove `isolatedModules` from its `tsconfig.spec.json` and re-run. If a
|
|
9
|
+
`TS2307: Cannot find module` error then appears for a workspace library, that project
|
|
10
|
+
needs `isolatedModules` - keep it and fix the source instead (avoid mixing
|
|
11
|
+
`module.exports` with an ESM `export`, and avoid cross-file `const enum`).
|
|
12
|
+
|
|
13
|
+
Re-run until the projects this migration touched typecheck. See the migration
|
|
14
|
+
documentation for details.
|
package/migrations.json
CHANGED
|
@@ -79,12 +79,13 @@
|
|
|
79
79
|
"documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
|
|
80
80
|
},
|
|
81
81
|
"set-ts-jest-isolated-modules": {
|
|
82
|
-
"version": "23.1.0-beta.
|
|
82
|
+
"version": "23.1.0-beta.4",
|
|
83
83
|
"requires": {
|
|
84
84
|
"ts-jest": ">=29.2.0"
|
|
85
85
|
},
|
|
86
|
-
"description": "Set `isolatedModules: true` in `tsconfig.spec.json` for ts-jest projects on TypeScript < 6
|
|
86
|
+
"description": "Set `isolatedModules: true` in `tsconfig.spec.json` for ts-jest projects on TypeScript < 6 (ts-jest 29.2+ forces `moduleResolution: node10` on the CommonJS path, which ignores package `exports` maps and breaks resolution of exports-only workspace libraries), then verify the workspace still typechecks and remedy any failures the change surfaced.",
|
|
87
87
|
"implementation": "./dist/src/migrations/update-23-1-0/set-ts-jest-isolated-modules",
|
|
88
|
+
"prompt": "./dist/src/migrations/update-23-1-0/verify-typecheck.md",
|
|
88
89
|
"documentation": "./dist/src/migrations/update-23-1-0/set-ts-jest-isolated-modules.md"
|
|
89
90
|
}
|
|
90
91
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/jest",
|
|
3
|
-
"version": "23.1.0-beta.
|
|
3
|
+
"version": "23.1.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"semver": "^7.6.3",
|
|
118
118
|
"tslib": "^2.3.0",
|
|
119
119
|
"yargs-parser": "21.1.1",
|
|
120
|
-
"@nx/devkit": "23.1.0-beta.
|
|
121
|
-
"@nx/js": "23.1.0-beta.
|
|
120
|
+
"@nx/devkit": "23.1.0-beta.4",
|
|
121
|
+
"@nx/js": "23.1.0-beta.4"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"nx": "23.1.0-beta.
|
|
124
|
+
"nx": "23.1.0-beta.4"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|