ts-jest 29.4.4 → 29.4.6

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
- 3113ed1dffc76f39434f1785e4e4ceabf4af1f0b
1
+ 9c5723b3a80e42c2cca16e1fcb1e90b882759305
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [29.4.6](https://github.com/kulshekhar/ts-jest/compare/v29.4.5...v29.4.6) (2025-12-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * log hybrid module as warning instead of failing tests ([#5144](https://github.com/kulshekhar/ts-jest/issues/5144)) ([528d37c](https://github.com/kulshekhar/ts-jest/commit/528d37c125a392a4a6e44a1bf399943410298390)), closes [#5130](https://github.com/kulshekhar/ts-jest/issues/5130)
7
+
8
+
9
+
10
+ ## [29.4.5](https://github.com/kulshekhar/ts-jest/compare/v29.4.4...v29.4.5) (2025-10-10)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 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)
16
+
17
+
18
+
1
19
  ## [29.4.4](https://github.com/kulshekhar/ts-jest/compare/v29.4.3...v29.4.4) (2025-09-19)
2
20
 
3
21
 
@@ -12,7 +30,7 @@
12
30
 
13
31
  ### Bug Fixes
14
32
 
15
- * 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)
33
+ * 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))
16
34
 
17
35
 
18
36
 
@@ -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 (!this._initialCompilerOptions.isolatedModules && (0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
144
- this._logger.warn("Using hybrid module kind (Node16/18/Next) is only supported in \"isolatedModules: true\". Please set \"isolatedModules: true\" in your tsconfig.json." /* 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,18 @@ 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
+ this.configSet.raiseDiagnostics([
159
+ {
160
+ category: this._ts.DiagnosticCategory.Message,
161
+ code: utils_1.TsJestDiagnosticCodes.ModernNodeModule,
162
+ messageText: messages_1.Helps.UsingModernNodeResolution,
163
+ file: undefined,
164
+ start: undefined,
165
+ length: undefined,
166
+ },
167
+ ]);
168
+ }
160
169
  if (!isEsmMode && diagnostics.length) {
161
170
  this.configSet.raiseDiagnostics(diagnostics, fileName, this._logger);
162
171
  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 {
@@ -449,7 +449,7 @@ class ConfigSet {
449
449
  !warningModulesForEsmInterop.includes(moduleValue) &&
450
450
  !(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
451
451
  result.errors.push({
452
- code: messages_1.TsJestDiagnosticCodes.ConfigModuleOption,
452
+ code: utils_1.TsJestDiagnosticCodes.ConfigModuleOption,
453
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 */,
454
454
  category: this.compilerModule.DiagnosticCategory.Message,
455
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 {}
@@ -41,7 +41,9 @@ function getNewLineCharacter(options) {
41
41
  }
42
42
  }
43
43
  const isModernNodeModuleKind = (module) => {
44
- return module ? [typescript_1.default.ModuleKind.Node16, /* ModuleKind.Node18 */ 101, typescript_1.default.ModuleKind.NodeNext].includes(module) : false;
44
+ return module
45
+ ? [typescript_1.default.ModuleKind.Node16, /* ModuleKind.Node18 */ 101, /* ModuleKind.Node20 */ 102, typescript_1.default.ModuleKind.NodeNext].includes(module)
46
+ : false;
45
47
  };
46
48
  exports.isModernNodeModuleKind = isModernNodeModuleKind;
47
49
  const shouldCheckProjectPkgJsonContent = (fileName, moduleKind) => {
@@ -160,7 +162,7 @@ const transpileWorker = (input, transpileOptions) => {
160
162
  if (outputText === undefined) {
161
163
  diagnostics.push({
162
164
  category: typescript_1.default.DiagnosticCategory.Error,
163
- code: messages_1.TsJestDiagnosticCodes.Generic,
165
+ code: utils_1.TsJestDiagnosticCodes.Generic,
164
166
  messageText: 'No output generated',
165
167
  file: sourceFile,
166
168
  start: 0,
@@ -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.4",
3
+ "version": "29.4.6",
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.1",
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.39.1",
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",
@@ -106,18 +106,18 @@
106
106
  "@types/lodash.camelcase": "^4.3.9",
107
107
  "@types/lodash.memoize": "^4.1.9",
108
108
  "@types/lodash.set": "^4.3.9",
109
- "@types/micromatch": "^4.0.9",
110
- "@types/node": "20.19.17",
109
+ "@types/micromatch": "^4.0.10",
110
+ "@types/node": "20.19.25",
111
111
  "@types/semver": "^7.7.1",
112
- "@types/yargs": "^17.0.33",
112
+ "@types/yargs": "^17.0.35",
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",
117
- "conventional-changelog-angular": "^8.0.0",
118
- "conventional-changelog-cli": "^5.0.0",
119
- "esbuild": "~0.25.10",
120
- "eslint": "^9.35.0",
114
+ "@typescript-eslint/eslint-plugin": "^8.48.0",
115
+ "@typescript-eslint/parser": "^8.48.0",
116
+ "babel-jest": "^30.2.0",
117
+ "conventional-changelog-angular": "^8.1.0",
118
+ "conventional-changelog": "^7.1.1",
119
+ "esbuild": "~0.27.0",
120
+ "eslint": "^9.39.1",
121
121
  "eslint-config-prettier": "^10.1.8",
122
122
  "eslint-plugin-import": "^2.32.0",
123
123
  "eslint-plugin-jest": "^28.14.0",
@@ -126,17 +126,17 @@
126
126
  "execa": "5.1.1",
127
127
  "fast-glob": "^3.3.3",
128
128
  "fs-extra": "^11.3.2",
129
- "globals": "^16.4.0",
129
+ "globals": "^16.5.0",
130
130
  "husky": "^9.1.7",
131
- "jest": "^30.1.3",
132
- "js-yaml": "^4.1.0",
131
+ "jest": "^30.2.0",
132
+ "js-yaml": "^4.1.1",
133
133
  "lint-staged": "^15.5.2",
134
- "memfs": "^4.42.0",
134
+ "memfs": "^4.51.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.48.0"
140
140
  },
141
141
  "engines": {
142
142
  "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"