ts-jest 29.4.10 → 29.4.12

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/.ts-jest-digest CHANGED
@@ -1 +1 @@
1
- 19e702f0a49983ce6d92683fb1199ea2acf8e36a
1
+ e03565d622606f8aecc2fef451190dba6868e7fe
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [29.4.12](https://github.com/kulshekhar/ts-jest/compare/v29.4.11...v29.4.12) (2026-07-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * **compiler:** support TypeScript 7 projects through compatibility aliases ([#5386](https://github.com/kulshekhar/ts-jest/pull/5386))
7
+
8
+ ## [29.4.11](https://github.com/kulshekhar/ts-jest/compare/v29.4.10...v29.4.11) (2026-05-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * preserve Bundler on the CJS path under TypeScript >= 6 ([3941818](https://github.com/kulshekhar/ts-jest/commit/39418187515f11b6584d35a4e3ddf50231f74936)), closes [#4198](https://github.com/kulshekhar/ts-jest/issues/4198)
14
+
15
+
16
+
1
17
  ## [29.4.10](https://github.com/kulshekhar/ts-jest/compare/v29.4.9...v29.4.10) (2026-05-18)
2
18
 
3
19
 
@@ -2062,4 +2078,3 @@ For example
2062
2078
  # 0.0.0 (2016-08-30)
2063
2079
 
2064
2080
 
2065
-
package/README.md CHANGED
@@ -35,12 +35,15 @@ It supports all features of TypeScript including type-checking. [Read more about
35
35
 
36
36
  These instructions will get you setup to use `ts-jest` in your project. For more detailed documentation, please check [online documentation](https://kulshekhar.github.io/ts-jest).
37
37
 
38
- | | using npm | using yarn |
39
- | ------------------: | ------------------------------ | ------------------------------------ |
40
- | **Prerequisites** | `npm i -D jest typescript` | `yarn add --dev jest typescript` |
41
- | **Installing** | `npm i -D ts-jest @types/jest` | `yarn add --dev ts-jest @types/jest` |
42
- | **Creating config** | `npx ts-jest config:init` | `yarn ts-jest config:init` |
43
- | **Running tests** | `npm test` or `npx jest` | `yarn test` or `yarn jest` |
38
+ | | using npm | using yarn |
39
+ | -----------------------------------: | ------------------------------ | ------------------------------------ |
40
+ | **Prerequisites (TypeScript 4.3–6)** | `npm i -D jest typescript` | `yarn add --dev jest typescript` |
41
+ | **Installing** | `npm i -D ts-jest @types/jest` | `yarn add --dev ts-jest @types/jest` |
42
+ | **Creating config** | `npx ts-jest config:init` | `yarn ts-jest config:init` |
43
+ | **Running tests** | `npm test` or `npx jest` | `yarn test` or `yarn jest` |
44
+
45
+ If your project uses TypeScript 7, follow the [supported side-by-side compiler setup](website/docs/guides/typescript-7.md)
46
+ instead of installing `typescript` directly.
44
47
 
45
48
  ## Built With
46
49
 
@@ -66,11 +66,11 @@ export declare class TsCompiler implements TsCompilerInstance {
66
66
  * supports.)
67
67
  *
68
68
  * - User-supplied Bundler with a non-Bundler-compatible forced module is
69
- * also TS5095 on the supported TS range — substitute Node10. (TypeScript
70
- * 6 relaxed this for `module: CommonJS` specifically; that relaxation is
71
- * deliberately not encoded here so behavior stays consistent across the
72
- * full peerDependency range. See `isBundlerCompatibleModuleKind` for the
73
- * follow-up pointer.)
69
+ * TS5095, substitute Node10. (TypeScript 6 relaxed this for
70
+ * `module: CommonJS` specifically; that relaxation is encoded inside
71
+ * `isBundlerCompatibleModuleKind` via a runtime version check, so on
72
+ * TS 6 user-supplied Bundler passes through unchanged on the CJS
73
+ * path.)
74
74
  *
75
75
  * - Anything else (Node10 / Classic / unset) passes through or falls back
76
76
  * to Node10. These pairings are valid with every forced module kind.
@@ -94,13 +94,12 @@ export declare class TsCompiler implements TsCompilerInstance {
94
94
  * user-supplied-`Bundler` pass-through, so neither path emits an invalid
95
95
  * pair when the user has selected a non-ES `module`.
96
96
  *
97
- * Note: TypeScript 6.0 relaxed this restriction for `module: CommonJS`
98
- * specifically (`CommonJS` + `Bundler` is now a valid pair on TS ≥ 6); the
99
- * other non-ES module kinds (`AMD` / `UMD` / `System` / `None`) remain
100
- * Bundler-incompatible on every TypeScript version. The TS 6 relaxation is
101
- * intentionally not encoded here to keep behavior consistent across the full
102
- * peerDependency range (`>=4.3 <7`); honoring it can ride in as a follow-up
103
- * once the TS 6 baseline lands.
97
+ * TypeScript 6.0 relaxed TS5095 for `module: CommonJS` specifically
98
+ * (`CommonJS` + `Bundler` is a valid pair on TS ≥ 6); the other non-ES
99
+ * module kinds (`AMD` / `UMD` / `System` / `None`) remain Bundler-incompatible
100
+ * on every TypeScript version. The version is detected at runtime from
101
+ * `this._ts.version` so the function stays correct across the full
102
+ * peerDependency range (`>=4.3 <7`).
104
103
  *
105
104
  * @see https://www.typescriptlang.org/tsconfig/#moduleResolution
106
105
  */
@@ -125,5 +124,12 @@ export declare class TsCompiler implements TsCompilerInstance {
125
124
  private preserveCustomConditionsIfCompatible;
126
125
  getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
127
126
  protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput;
127
+ /**
128
+ * TypeScript 6 reports TS5107 when ts-jest's historical default of
129
+ * `moduleResolution: Node10` is passed to `transpileModule`. The diagnostic
130
+ * is an implementation detail when ts-jest injected that value, but remains
131
+ * actionable when the user selected Node10 themselves.
132
+ */
133
+ private _filterDiagnosticsFromTsJestDefaults;
128
134
  protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
129
135
  }
@@ -181,11 +181,11 @@ class TsCompiler {
181
181
  * supports.)
182
182
  *
183
183
  * - User-supplied Bundler with a non-Bundler-compatible forced module is
184
- * also TS5095 on the supported TS range — substitute Node10. (TypeScript
185
- * 6 relaxed this for `module: CommonJS` specifically; that relaxation is
186
- * deliberately not encoded here so behavior stays consistent across the
187
- * full peerDependency range. See `isBundlerCompatibleModuleKind` for the
188
- * follow-up pointer.)
184
+ * TS5095, substitute Node10. (TypeScript 6 relaxed this for
185
+ * `module: CommonJS` specifically; that relaxation is encoded inside
186
+ * `isBundlerCompatibleModuleKind` via a runtime version check, so on
187
+ * TS 6 user-supplied Bundler passes through unchanged on the CJS
188
+ * path.)
189
189
  *
190
190
  * - Anything else (Node10 / Classic / unset) passes through or falls back
191
191
  * to Node10. These pairings are valid with every forced module kind.
@@ -224,13 +224,12 @@ class TsCompiler {
224
224
  * user-supplied-`Bundler` pass-through, so neither path emits an invalid
225
225
  * pair when the user has selected a non-ES `module`.
226
226
  *
227
- * Note: TypeScript 6.0 relaxed this restriction for `module: CommonJS`
228
- * specifically (`CommonJS` + `Bundler` is now a valid pair on TS ≥ 6); the
229
- * other non-ES module kinds (`AMD` / `UMD` / `System` / `None`) remain
230
- * Bundler-incompatible on every TypeScript version. The TS 6 relaxation is
231
- * intentionally not encoded here to keep behavior consistent across the full
232
- * peerDependency range (`>=4.3 <7`); honoring it can ride in as a follow-up
233
- * once the TS 6 baseline lands.
227
+ * TypeScript 6.0 relaxed TS5095 for `module: CommonJS` specifically
228
+ * (`CommonJS` + `Bundler` is a valid pair on TS ≥ 6); the other non-ES
229
+ * module kinds (`AMD` / `UMD` / `System` / `None`) remain Bundler-incompatible
230
+ * on every TypeScript version. The version is detected at runtime from
231
+ * `this._ts.version` so the function stays correct across the full
232
+ * peerDependency range (`>=4.3 <7`).
234
233
  *
235
234
  * @see https://www.typescriptlang.org/tsconfig/#moduleResolution
236
235
  */
@@ -244,6 +243,11 @@ class TsCompiler {
244
243
  if (M.Preserve !== undefined && moduleKind === M.Preserve) {
245
244
  return true;
246
245
  }
246
+ // TS 6 made `CommonJS` + `Bundler` a valid pair.
247
+ if (moduleKind === M.CommonJS) {
248
+ const tsMajor = parseInt(this._ts.version.split('.')[0], 10);
249
+ return tsMajor >= 6;
250
+ }
247
251
  return false;
248
252
  }
249
253
  /**
@@ -372,12 +376,14 @@ class TsCompiler {
372
376
  * This code path should be removed in the next major version to benefit from checking on compiler options
373
377
  */
374
378
  if (!(0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
375
- return this._ts.transpileModule(fileContent, {
379
+ const result = this._ts.transpileModule(fileContent, {
376
380
  fileName,
377
381
  transformers: this._makeTransformers(this.configSet.resolvedTransformers),
378
382
  compilerOptions: this._compilerOptions,
379
383
  reportDiagnostics: this.configSet.shouldReportDiagnostics(fileName),
380
384
  });
385
+ const diagnostics = this._filterDiagnosticsFromTsJestDefaults(result.diagnostics);
386
+ return diagnostics === result.diagnostics ? result : { ...result, diagnostics };
381
387
  }
382
388
  return (0, transpile_module_1.tsTranspileModule)(fileContent, {
383
389
  fileName,
@@ -389,6 +395,24 @@ class TsCompiler {
389
395
  reportDiagnostics: fileName ? this.configSet.shouldReportDiagnostics(fileName) : false,
390
396
  });
391
397
  }
398
+ /**
399
+ * TypeScript 6 reports TS5107 when ts-jest's historical default of
400
+ * `moduleResolution: Node10` is passed to `transpileModule`. The diagnostic
401
+ * is an implementation detail when ts-jest injected that value, but remains
402
+ * actionable when the user selected Node10 themselves.
403
+ */
404
+ _filterDiagnosticsFromTsJestDefaults(diagnostics) {
405
+ // `Node10` was exposed as `NodeJs` (with the same value) by older supported TypeScript releases.
406
+ const node10 = this._ts.ModuleResolutionKind.Node10 ?? 2;
407
+ const tsMajor = Number.parseInt(this._ts.version.split('.')[0], 10);
408
+ const hasInjectedNode10 = tsMajor >= 6 &&
409
+ this._initialCompilerOptions.moduleResolution === undefined &&
410
+ this._compilerOptions.moduleResolution === node10;
411
+ if (!hasInjectedNode10 || !diagnostics?.some((diagnostic) => diagnostic.code === 5107)) {
412
+ return diagnostics;
413
+ }
414
+ return diagnostics.filter((diagnostic) => diagnostic.code !== 5107);
415
+ }
392
416
  _makeTransformers(customTransformers) {
393
417
  return {
394
418
  before: customTransformers.before.map((beforeTransformer) => beforeTransformer.factory(this, beforeTransformer.options)),
@@ -27,7 +27,17 @@ class Importer {
27
27
  return this._import(why, '@babel/core');
28
28
  }
29
29
  typescript(why, which) {
30
- return this._import(why, which);
30
+ const compilerModule = this._import(why, which);
31
+ const hasRequiredCompilerApi = typeof compilerModule.createLanguageService === 'function' &&
32
+ typeof compilerModule.parseJsonConfigFileContent === 'function' &&
33
+ typeof compilerModule.transpileModule === 'function';
34
+ if (!hasRequiredCompilerApi) {
35
+ throw new Error((0, messages_1.interpolate)("The TypeScript compiler \"{{module}}\" (version {{version}}) does not expose the JavaScript compiler API required by ts-jest. To use TypeScript 7 for project type-checking, install it as \"@typescript/native\" and alias \"@typescript/typescript6\" as \"typescript\" for ts-jest." /* Errors.TypeScriptCompilerApiUnavailable */, {
36
+ module: which,
37
+ version: compilerModule.version ?? 'unknown',
38
+ }));
39
+ }
40
+ return compilerModule;
31
41
  }
32
42
  esBuild(why) {
33
43
  return this._import(why, 'esbuild');
package/npm-view.err ADDED
@@ -0,0 +1,9 @@
1
+ npm warn Unknown user config "always-auth". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
2
+ npm error code E404
3
+ npm error 404 No match found for version 29.4.12
4
+ npm error 404
5
+ npm error 404 The requested resource 'ts-jest@29.4.12' could not be found or you do not have permission to access it.
6
+ npm error 404
7
+ npm error 404 Note that you can also install from a
8
+ npm error 404 tarball, folder, http url, or git url.
9
+ npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2026-07-22T07_45_38_792Z-debug-0.log
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.4.10",
3
+ "version": "29.4.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "commonjs",
@@ -57,7 +57,7 @@
57
57
  "json5": "^2.2.3",
58
58
  "lodash.memoize": "^4.1.2",
59
59
  "make-error": "^1.3.6",
60
- "semver": "^7.8.0",
60
+ "semver": "^7.8.5",
61
61
  "type-fest": "^4.41.0",
62
62
  "yargs-parser": "^21.1.1"
63
63
  },
@@ -94,8 +94,8 @@
94
94
  "@commitlint/cli": "^19.8.1",
95
95
  "@commitlint/config-angular": "^19.8.1",
96
96
  "@eslint/compat": "^1.4.1",
97
- "@eslint/eslintrc": "^3.3.5",
98
- "@eslint/js": "^9.39.4",
97
+ "@eslint/eslintrc": "^3.3.6",
98
+ "@eslint/js": "^9.39.5",
99
99
  "@jest/globals": "^30.4.1",
100
100
  "@jest/transform": "^30.4.1",
101
101
  "@jest/types": "^30.4.1",
@@ -107,17 +107,17 @@
107
107
  "@types/lodash.memoize": "^4.1.9",
108
108
  "@types/lodash.set": "^4.3.9",
109
109
  "@types/micromatch": "^4.0.10",
110
- "@types/node": "20.19.41",
110
+ "@types/node": "20.19.43",
111
111
  "@types/semver": "^7.7.1",
112
112
  "@types/yargs": "^17.0.35",
113
113
  "@types/yargs-parser": "21.0.3",
114
- "@typescript-eslint/eslint-plugin": "^8.59.3",
115
- "@typescript-eslint/parser": "^8.59.3",
114
+ "@typescript-eslint/eslint-plugin": "^8.64.0",
115
+ "@typescript-eslint/parser": "^8.64.0",
116
116
  "babel-jest": "^30.4.1",
117
117
  "conventional-changelog-angular": "^8.3.1",
118
- "conventional-changelog": "^7.2.0",
119
- "esbuild": "~0.28.0",
120
- "eslint": "^9.39.4",
118
+ "conventional-changelog": "^7.2.1",
119
+ "esbuild": "~0.28.1",
120
+ "eslint": "^9.39.5",
121
121
  "eslint-config-prettier": "^10.1.8",
122
122
  "eslint-plugin-import": "^2.32.0",
123
123
  "eslint-plugin-jest": "^28.14.0",
@@ -125,18 +125,18 @@
125
125
  "eslint-plugin-prettier": "^4.2.5",
126
126
  "execa": "5.1.1",
127
127
  "fast-glob": "^3.3.3",
128
- "fs-extra": "^11.3.5",
128
+ "fs-extra": "^11.3.6",
129
129
  "globals": "^16.5.0",
130
130
  "husky": "^9.1.7",
131
131
  "jest": "^30.4.2",
132
- "js-yaml": "^4.1.1",
132
+ "js-yaml": "^4.3.0",
133
133
  "lint-staged": "^15.5.2",
134
- "memfs": "^4.57.2",
134
+ "memfs": "^4.64.0",
135
135
  "prettier": "^2.8.8",
136
136
  "rimraf": "^5.0.10",
137
137
  "ts-node": "^10.9.2",
138
138
  "typescript": "~5.9.3",
139
- "typescript-eslint": "^8.59.3"
139
+ "typescript-eslint": "^8.64.0"
140
140
  },
141
141
  "engines": {
142
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"