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 +1 -1
- package/CHANGELOG.md +19 -1
- package/dist/legacy/compiler/ts-compiler.js +10 -3
- package/dist/legacy/config/config-set.d.ts +1 -1
- package/dist/legacy/config/config-set.js +11 -3
- package/dist/transpilers/typescript/transpile-module.js +2 -2
- package/dist/types.d.ts +5 -7
- package/dist/utils/backports.js +1 -1
- package/dist/utils/diagnostics.d.ts +5 -0
- package/dist/utils/diagnostics.js +8 -0
- package/dist/utils/importer.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/messages.d.ts +1 -4
- package/dist/utils/messages.js +10 -5
- package/package.json +17 -17
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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))
|
|
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
|
|
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.
|
|
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 ??
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
43
|
-
*/
|
|
44
|
-
isolatedModules?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Compiles files using {@link _ts.transpileModule})
|
|
42
|
+
* @deprecated use {@link TsConfigCompilerOptionsJson.isolatedModules} instead
|
|
47
43
|
*
|
|
48
|
-
*
|
|
44
|
+
* Compiles files as isolated modules (disables some features)
|
|
45
|
+
*
|
|
46
|
+
* @default `undefined` (disables transpiling files with {@link _ts.transpileModule})
|
|
49
47
|
*/
|
|
50
|
-
|
|
48
|
+
isolatedModules?: boolean;
|
|
51
49
|
/**
|
|
52
50
|
* Compiler to use
|
|
53
51
|
*
|
package/dist/utils/backports.js
CHANGED
|
@@ -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,
|
|
87
|
+
logger.warn(context, messages_1.Helps.MigrateConfigUsingCLI);
|
|
88
88
|
}
|
|
89
89
|
return {
|
|
90
90
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/dist/utils/importer.js
CHANGED
|
@@ -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)(
|
|
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,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/dist/utils/messages.d.ts
CHANGED
package/dist/utils/messages.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
+
"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.
|
|
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.
|
|
96
|
+
"@eslint/compat": "^1.4.0",
|
|
97
97
|
"@eslint/eslintrc": "^3.3.1",
|
|
98
|
-
"@eslint/js": "^9.
|
|
99
|
-
"@jest/globals": "^30.
|
|
100
|
-
"@jest/transform": "^30.
|
|
101
|
-
"@jest/types": "^30.0
|
|
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.
|
|
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.
|
|
115
|
-
"@typescript-eslint/parser": "^8.
|
|
116
|
-
"babel-jest": "^30.
|
|
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
|
|
118
|
+
"conventional-changelog": "^7.1.1",
|
|
119
119
|
"esbuild": "~0.25.10",
|
|
120
|
-
"eslint": "^9.
|
|
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.
|
|
131
|
+
"jest": "^30.2.0",
|
|
132
132
|
"js-yaml": "^4.1.0",
|
|
133
133
|
"lint-staged": "^15.5.2",
|
|
134
|
-
"memfs": "^4.
|
|
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.
|
|
139
|
-
"typescript-eslint": "^8.
|
|
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"
|