ts-jest 29.4.3 → 29.4.5

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
- 24f9edf45cda60954ee633a4b195ea486d624aeb
1
+ 95c19722f9888efe1c4d137d0f48593d329ceeaf
package/CHANGELOG.md CHANGED
@@ -1,9 +1,27 @@
1
+ ## [29.4.5](https://github.com/kulshekhar/ts-jest/compare/v29.4.4...v29.4.5) (2025-10-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * allow filtering modern module warning message with diagnostic code ([c290d4d](https://github.com/kulshekhar/ts-jest/commit/c290d4d7f68b47bc4f31b26f241b93ef667dcb72)), , closes [#5013](https://github.com/kulshekhar/ts-jest/issues/5013)
7
+
8
+
9
+
10
+ ## [29.4.4](https://github.com/kulshekhar/ts-jest/compare/v29.4.3...v29.4.4) (2025-09-19)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * revert **29.4.3** changes ([25cb706](https://github.com/kulshekhar/ts-jest/commit/25cb7065528f7a43b6c6ee5bb33fc3f940932ccd)), closes [#5049](https://github.com/kulshekhar/ts-jest/issues/5049)
16
+
17
+
18
+
1
19
  ## [29.4.3](https://github.com/kulshekhar/ts-jest/compare/v29.4.2...v29.4.3) (2025-09-17)
2
20
 
3
21
 
4
22
  ### Bug Fixes
5
23
 
6
- * introduce `transpilation` option to replace `isolatedModules` option ([#5044](https://github.com/kulshekhar/ts-jest/issues/5044)) ([5868761](https://github.com/kulshekhar/ts-jest/commit/58687615142d89a559ada89d12029fe29bb981f2)), closes [#5013](https://github.com/kulshekhar/ts-jest/issues/5013) [#4859](https://github.com/kulshekhar/ts-jest/issues/4859)
24
+ * introduce `transpilation` option to replace `isolatedModules` option ([#5044](https://github.com/kulshekhar/ts-jest/issues/5044)) ([5868761](https://github.com/kulshekhar/ts-jest/commit/58687615142d89a559ada89d12029fe29bb981f2))
7
25
 
8
26
 
9
27
 
@@ -140,9 +140,6 @@ class TsCompiler {
140
140
  getCompiledOutput(fileContent, fileName, options) {
141
141
  const isEsmMode = this.configSet.useESM && options.supportsStaticESM;
142
142
  this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode);
143
- if ((0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module) && !this.configSet.isolatedModules) {
144
- this._logger.warn("Using hybrid module kind (Node16/18/Next) is only supported in \"transpilation: true\". Please set \"transpilation: true\" in for `ts-jest` config in your Jest config file, see https://kulshekhar.github.io/ts-jest/docs/getting-started/options/transpilation" /* Helps.UsingModernNodeResolution */);
145
- }
146
143
  const moduleKind = this._initialCompilerOptions.module;
147
144
  const currentModuleKind = this._compilerOptions.module;
148
145
  if (this._languageService) {
@@ -157,6 +154,16 @@ class TsCompiler {
157
154
  this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
158
155
  const output = this._languageService.getEmitOutput(fileName);
159
156
  const diagnostics = this.getDiagnostics(fileName);
157
+ if ((0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
158
+ diagnostics.push({
159
+ category: this._ts.DiagnosticCategory.Message,
160
+ code: utils_1.TsJestDiagnosticCodes.ModernNodeModule,
161
+ messageText: messages_1.Helps.UsingModernNodeResolution,
162
+ file: undefined,
163
+ start: undefined,
164
+ length: undefined,
165
+ });
166
+ }
160
167
  if (!isEsmMode && diagnostics.length) {
161
168
  this.configSet.raiseDiagnostics(diagnostics, fileName, this._logger);
162
169
  if (options.watchMode) {
@@ -1,6 +1,6 @@
1
1
  import { Logger } from 'bs-logger';
2
2
  import type * as ts from 'typescript';
3
- import type { TsConfigCompilerOptionsJson } from '../../config/types';
3
+ import type { TsConfigCompilerOptionsJson } from '../../config';
4
4
  import type { RawCompilerOptions } from '../../raw-compiler-options';
5
5
  import type { TsJestAstTransformer, TsJestTransformOptions, TTypeScript } from '../../types';
6
6
  export declare class ConfigSet {
@@ -216,9 +216,17 @@ class ConfigSet {
216
216
  this._matchTestFilePath = (0, jest_util_1.globsToMatcher)(this._matchablePatterns.filter((pattern) => typeof pattern === 'string'));
217
217
  // isolatedModules
218
218
  if (options.isolatedModules) {
219
- this.logger.warn("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"transpilation: true\" instead, see https://kulshekhar.github.io/ts-jest/docs/getting-started/options/transpilation\n " /* Deprecations.ReplaceIsolatedModulesWithTranspilation */);
219
+ this.parsedTsConfig.options.isolatedModules = true;
220
+ if (this.tsconfigFilePath) {
221
+ this.logger.warn((0, messages_1.interpolate)("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\" in {{tsconfigFilePath}} instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithTsconfigPath */, {
222
+ tsconfigFilePath: this.tsconfigFilePath,
223
+ }));
224
+ }
225
+ else {
226
+ this.logger.warn("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\", see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithoutTsconfigPath */);
227
+ }
220
228
  }
221
- this.isolatedModules = options.isolatedModules ?? options.transpilation ?? false;
229
+ this.isolatedModules = this.parsedTsConfig.options.isolatedModules ?? false;
222
230
  this._resolveTsCacheDir();
223
231
  }
224
232
  /**
@@ -441,7 +449,7 @@ class ConfigSet {
441
449
  !warningModulesForEsmInterop.includes(moduleValue) &&
442
450
  !(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
443
451
  result.errors.push({
444
- code: messages_1.TsJestDiagnosticCodes.ConfigModuleOption,
452
+ code: utils_1.TsJestDiagnosticCodes.ConfigModuleOption,
445
453
  messageText: "If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information." /* Errors.ConfigNoModuleInterop */,
446
454
  category: this.compilerModule.DiagnosticCategory.Message,
447
455
  file: undefined,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.tsTranspileModule = exports.isModernNodeModuleKind = void 0;
7
7
  const node_path_1 = __importDefault(require("node:path"));
8
8
  const typescript_1 = __importDefault(require("typescript"));
9
- const messages_1 = require("../../utils/messages");
9
+ const utils_1 = require("../../utils");
10
10
  const barebonesLibContent = `/// <reference no-default-lib="true"/>
11
11
  interface Boolean {}
12
12
  interface Function {}
@@ -160,7 +160,7 @@ const transpileWorker = (input, transpileOptions) => {
160
160
  if (outputText === undefined) {
161
161
  diagnostics.push({
162
162
  category: typescript_1.default.DiagnosticCategory.Error,
163
- code: messages_1.TsJestDiagnosticCodes.Generic,
163
+ code: utils_1.TsJestDiagnosticCodes.Generic,
164
164
  messageText: 'No output generated',
165
165
  file: sourceFile,
166
166
  start: 0,
package/dist/types.d.ts CHANGED
@@ -39,15 +39,13 @@ export type TsJestGlobalOptions = Config.TransformerConfig[1] & {
39
39
  */
40
40
  tsconfig?: boolean | string | RawCompilerOptions | TsConfigCompilerOptionsJson;
41
41
  /**
42
- * @deprecated use {@link transpilation} instead
43
- */
44
- isolatedModules?: boolean;
45
- /**
46
- * Compiles files using {@link _ts.transpileModule})
42
+ * @deprecated use {@link TsConfigCompilerOptionsJson.isolatedModules} instead
47
43
  *
48
- * @default `undefined` (disables)
44
+ * Compiles files as isolated modules (disables some features)
45
+ *
46
+ * @default `undefined` (disables transpiling files with {@link _ts.transpileModule})
49
47
  */
50
- transpilation?: boolean;
48
+ isolatedModules?: boolean;
51
49
  /**
52
50
  * Compiler to use
53
51
  *
@@ -84,7 +84,7 @@ const backportJestConfig = (logger, config) => {
84
84
  }
85
85
  // if we had some warnings we can inform the user about the CLI tool
86
86
  if (hadWarnings) {
87
- logger.warn(context, "Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>." /* Helps.MigrateConfigUsingCLI */);
87
+ logger.warn(context, messages_1.Helps.MigrateConfigUsingCLI);
88
88
  }
89
89
  return {
90
90
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -0,0 +1,5 @@
1
+ export declare const TsJestDiagnosticCodes: {
2
+ readonly Generic: 151000;
3
+ readonly ConfigModuleOption: 151001;
4
+ readonly ModernNodeModule: 151002;
5
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TsJestDiagnosticCodes = void 0;
4
+ exports.TsJestDiagnosticCodes = {
5
+ Generic: 151000,
6
+ ConfigModuleOption: 151001,
7
+ ModernNodeModule: 151002,
8
+ };
@@ -90,7 +90,7 @@ class Importer {
90
90
  installTip = [{ module: installTip, label: `install "${installTip}"` }];
91
91
  }
92
92
  const fix = installTip
93
- .map((tip) => ` ${installTip.length === 1 ? '↳' : '•'} ${(0, messages_1.interpolate)("{{label}}: `npm i -D {{module}}` (or `yarn add --dev {{module}}`)" /* Helps.FixMissingModule */, tip)}`)
93
+ .map((tip) => ` ${installTip.length === 1 ? '↳' : '•'} ${(0, messages_1.interpolate)(messages_1.Helps.FixMissingModule, tip)}`)
94
94
  .join('\n');
95
95
  throw new Error((0, messages_1.interpolate)(msg, {
96
96
  module: loadModule,
@@ -1,3 +1,4 @@
1
1
  export * from './json';
2
2
  export * from './jsonable-value';
3
3
  export * from './logger';
4
+ export * from './diagnostics';
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./json"), exports);
18
18
  __exportStar(require("./jsonable-value"), exports);
19
19
  __exportStar(require("./logger"), exports);
20
+ __exportStar(require("./diagnostics"), exports);
@@ -1,4 +1 @@
1
- export declare const TsJestDiagnosticCodes: {
2
- readonly Generic: 151000;
3
- readonly ConfigModuleOption: 151001;
4
- };
1
+ export {};
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TsJestDiagnosticCodes = void 0;
3
+ exports.Helps = void 0;
4
4
  exports.interpolate = interpolate;
5
+ const diagnostics_1 = require("./diagnostics");
6
+ /**
7
+ * @internal
8
+ */
9
+ exports.Helps = {
10
+ FixMissingModule: '{{label}}: `npm i -D {{module}}` (or `yarn add --dev {{module}}`)',
11
+ MigrateConfigUsingCLI: 'Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.',
12
+ UsingModernNodeResolution: `Using hybrid module kind (Node16/18/Next) is only supported in "isolatedModules: true". Please set "isolatedModules: true" in your tsconfig.json. To disable this message, you can set "diagnostics.ignoreCodes" to include ${diagnostics_1.TsJestDiagnosticCodes.ModernNodeModule} in your ts-jest config. See more at https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics`,
13
+ };
5
14
  /**
6
15
  * @internal
7
16
  */
@@ -10,7 +19,3 @@ function interpolate(msg, vars = {}) {
10
19
  // eslint-disable-next-line no-useless-escape
11
20
  return msg.replace(/\{\{([^\}]+)\}\}/g, (_, key) => (key in vars ? vars[key] : _));
12
21
  }
13
- exports.TsJestDiagnosticCodes = {
14
- Generic: 151000,
15
- ConfigModuleOption: 151001,
16
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "29.4.3",
3
+ "version": "29.4.5",
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.7.2",
60
+ "semver": "^7.7.3",
61
61
  "type-fest": "^4.41.0",
62
62
  "yargs-parser": "^21.1.1"
63
63
  },
@@ -93,12 +93,12 @@
93
93
  "devDependencies": {
94
94
  "@commitlint/cli": "^19.8.1",
95
95
  "@commitlint/config-angular": "^19.8.1",
96
- "@eslint/compat": "^1.3.2",
96
+ "@eslint/compat": "^1.4.0",
97
97
  "@eslint/eslintrc": "^3.3.1",
98
- "@eslint/js": "^9.35.0",
99
- "@jest/globals": "^30.1.2",
100
- "@jest/transform": "^30.1.2",
101
- "@jest/types": "^30.0.5",
98
+ "@eslint/js": "^9.37.0",
99
+ "@jest/globals": "^30.2.0",
100
+ "@jest/transform": "^30.2.0",
101
+ "@jest/types": "^30.2.0",
102
102
  "@types/babel__core": "^7.20.5",
103
103
  "@types/fs-extra": "^11.0.4",
104
104
  "@types/jest": "^29.5.14",
@@ -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.9",
110
- "@types/node": "20.19.16",
110
+ "@types/node": "20.19.20",
111
111
  "@types/semver": "^7.7.1",
112
112
  "@types/yargs": "^17.0.33",
113
113
  "@types/yargs-parser": "21.0.3",
114
- "@typescript-eslint/eslint-plugin": "^8.44.0",
115
- "@typescript-eslint/parser": "^8.44.0",
116
- "babel-jest": "^30.1.2",
114
+ "@typescript-eslint/eslint-plugin": "^8.46.0",
115
+ "@typescript-eslint/parser": "^8.46.0",
116
+ "babel-jest": "^30.2.0",
117
117
  "conventional-changelog-angular": "^8.0.0",
118
- "conventional-changelog-cli": "^5.0.0",
118
+ "conventional-changelog": "^7.1.1",
119
119
  "esbuild": "~0.25.10",
120
- "eslint": "^9.35.0",
120
+ "eslint": "^9.37.0",
121
121
  "eslint-config-prettier": "^10.1.8",
122
122
  "eslint-plugin-import": "^2.32.0",
123
123
  "eslint-plugin-jest": "^28.14.0",
@@ -128,15 +128,15 @@
128
128
  "fs-extra": "^11.3.2",
129
129
  "globals": "^16.4.0",
130
130
  "husky": "^9.1.7",
131
- "jest": "^30.1.3",
131
+ "jest": "^30.2.0",
132
132
  "js-yaml": "^4.1.0",
133
133
  "lint-staged": "^15.5.2",
134
- "memfs": "^4.42.0",
134
+ "memfs": "^4.49.0",
135
135
  "prettier": "^2.8.8",
136
136
  "rimraf": "^5.0.10",
137
137
  "ts-node": "^10.9.2",
138
- "typescript": "~5.9.2",
139
- "typescript-eslint": "^8.44.0"
138
+ "typescript": "~5.9.3",
139
+ "typescript-eslint": "^8.46.0"
140
140
  },
141
141
  "engines": {
142
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"