@depup/ts-jest 29.4.12-depup.0 → 29.4.14-depup.0
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 -0
- package/CONTRIBUTING.md +6 -20
- package/README.md +3 -3
- package/changes.json +2 -2
- package/dist/cli/config/migrate.js +5 -5
- package/dist/cli/helpers/presets.js +12 -5
- package/dist/config/paths-to-module-name-mapper.js +2 -2
- package/dist/legacy/compiler/ts-compiler.js +38 -16
- package/dist/legacy/config/config-set.js +10 -10
- package/dist/legacy/ts-jest-transformer.js +2 -2
- package/dist/utils/backports.js +3 -3
- package/dist/utils/importer.js +3 -3
- package/dist/utils/messages.js +49 -1
- package/dist/utils/ts-error.js +1 -1
- package/npm-view.err +3 -3
- package/package.json +19 -22
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
44df70f98f3cf89af95cce14fa68674b52acbfd3
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [29.4.14](https://github.com/kulshekhar/ts-jest/compare/v29.4.13...v29.4.14) (2026-09-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Reverts
|
|
5
|
+
|
|
6
|
+
* bring back prior changes of compiler util ([#5471](https://github.com/kulshekhar/ts-jest/issues/5471)) ([01e5a2e](https://github.com/kulshekhar/ts-jest/commit/01e5a2e17ac9c940880865d6a81751832dcc4184)), closes [#5469](https://github.com/kulshekhar/ts-jest/issues/5469)
|
|
7
|
+
|
|
8
|
+
## [29.4.13](https://github.com/kulshekhar/ts-jest/compare/v29.4.12...v29.4.13) (2026-09-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* support Babel 8 ([#5466](https://github.com/kulshekhar/ts-jest/issues/5466)) ([c3a0b57](https://github.com/kulshekhar/ts-jest/commit/c3a0b57c00d8b6acfb72b020e2411752d39073e2)), closes [#5412](https://github.com/kulshekhar/ts-jest/issues/5412)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Performance Improvements
|
|
17
|
+
|
|
18
|
+
* **compiler:** cache module resolution modes ([#5419](https://github.com/kulshekhar/ts-jest/issues/5419)) ([697d337](https://github.com/kulshekhar/ts-jest/commit/697d337c1b79a0804972a3d30c0875b02e73bf62)), closes [#5402](https://github.com/kulshekhar/ts-jest/issues/5402)
|
|
19
|
+
|
|
1
20
|
## [29.4.12](https://github.com/kulshekhar/ts-jest/compare/v29.4.11...v29.4.12) (2026-07-22)
|
|
2
21
|
|
|
3
22
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -48,28 +48,14 @@ this is where you will write it in. Tests here usually don't require much if any
|
|
|
48
48
|
|
|
49
49
|
##### Integration tests
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
The tests within this directory execute jest itself using `run-jest.ts` and assertions are usually made on one if not all
|
|
55
|
-
the output of the following `status`, `stdout` and `stderr`. The other subdirectories within the `e2e` directory are
|
|
56
|
-
where you will write the files that jest will run for your integration tests. Feel free to take a look at any of the tests
|
|
57
|
-
in the `__tests__` directory within `e2e` to have a better sense of how it is currently being done.
|
|
58
|
-
|
|
59
|
-
It is possible to run the integration test itself manually to inspect that the new behaviour is indeed correct.
|
|
60
|
-
Here is a small code snippet of how to do just that. This is useful when debugging a failing test.
|
|
51
|
+
Integration tests reside in `e2e`. Controller tests under `e2e/__tests__` select isolated fixture projects and execute
|
|
52
|
+
their local Jest configurations through `run-jest.ts`. Each fixture owns its package metadata, Jest configuration,
|
|
53
|
+
TypeScript configuration, source files, and tests. Dependencies and lockfiles belong only to fixtures that require them.
|
|
61
54
|
|
|
62
55
|
```bash
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
✓ stub (3ms)
|
|
67
|
-
|
|
68
|
-
Test Suites: 1 passed, 1 total
|
|
69
|
-
Tests: 1 passed, 1 total
|
|
70
|
-
Snapshots: 0 total
|
|
71
|
-
Time: 0.232 s, estimated 1 s
|
|
72
|
-
Ran all test suites.
|
|
56
|
+
npm run build
|
|
57
|
+
npm run test-e2e
|
|
58
|
+
npm run test-e2e -- --runTestsByPath e2e/__tests__/test-utils.test.ts
|
|
73
59
|
```
|
|
74
60
|
|
|
75
61
|
### Additional Workflow for any changes made to website or docs
|
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/ts-jest
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [ts-jest](https://www.npmjs.com/package/ts-jest) @ 29.4.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [ts-jest](https://www.npmjs.com/package/ts-jest) @ 29.4.14 |
|
|
17
|
+
| Processed | 2026-09-27 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 2 |
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ npm install @depup/ts-jest
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| type-fest | ^4.41.0 | ^5.
|
|
25
|
+
| type-fest | ^4.41.0 | ^5.10.0 |
|
|
26
26
|
| yargs-parser | ^21.1.1 | ^22.0.0 |
|
|
27
27
|
|
|
28
28
|
---
|
package/changes.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"bumped": {
|
|
3
3
|
"type-fest": {
|
|
4
4
|
"from": "^4.41.0",
|
|
5
|
-
"to": "^5.
|
|
5
|
+
"to": "^5.10.0"
|
|
6
6
|
},
|
|
7
7
|
"yargs-parser": {
|
|
8
8
|
"from": "^21.1.1",
|
|
9
9
|
"to": "^22.0.0"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"timestamp": "2026-
|
|
12
|
+
"timestamp": "2026-09-27T01:04:34.958Z",
|
|
13
13
|
"totalUpdated": 2
|
|
14
14
|
}
|
|
@@ -32,9 +32,9 @@ const migrateGlobalConfigToTransformConfig = (transformConfig, globalsTsJestConf
|
|
|
32
32
|
};
|
|
33
33
|
const migratePresetToTransformConfig = (transformConfig, preset, globalsTsJestConfig) => {
|
|
34
34
|
if (preset) {
|
|
35
|
-
const transformConfigFromPreset = preset.name ===
|
|
35
|
+
const transformConfigFromPreset = preset.name === presets_1.JestPresetNames.jsWithTs
|
|
36
36
|
? (0, create_jest_preset_1.createJsWithTsPreset)(globalsTsJestConfig)
|
|
37
|
-
: preset.name ===
|
|
37
|
+
: preset.name === presets_1.JestPresetNames.jsWIthBabel
|
|
38
38
|
? (0, create_jest_preset_1.createJsWithBabelPreset)(globalsTsJestConfig)
|
|
39
39
|
: (0, create_jest_preset_1.createDefaultPreset)(globalsTsJestConfig);
|
|
40
40
|
return {
|
|
@@ -72,14 +72,14 @@ const run = async (args /* , logger: Logger*/) => {
|
|
|
72
72
|
let preset;
|
|
73
73
|
if (migratedConfig.preset) {
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
preset = presets_1.allPresets[migratedConfig.preset] ?? presets_1.allPresets[
|
|
75
|
+
preset = presets_1.allPresets[migratedConfig.preset] ?? presets_1.allPresets[presets_1.JestPresetNames.default];
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
if (args.js) {
|
|
79
|
-
preset = args.js === 'babel' ? presets_1.allPresets[
|
|
79
|
+
preset = args.js === 'babel' ? presets_1.allPresets[presets_1.JestPresetNames.jsWIthBabel] : presets_1.allPresets[presets_1.JestPresetNames.jsWithTs];
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
preset = presets_1.allPresets[
|
|
82
|
+
preset = presets_1.allPresets[presets_1.JestPresetNames.default];
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
// check the extensions
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsWIthBabel = exports.jsWithTs = exports.defaults = exports.allPresets = void 0;
|
|
3
|
+
exports.jsWIthBabel = exports.jsWithTs = exports.defaults = exports.allPresets = exports.JestPresetNames = void 0;
|
|
4
|
+
/** @internal */
|
|
5
|
+
var JestPresetNames;
|
|
6
|
+
(function (JestPresetNames) {
|
|
7
|
+
JestPresetNames["default"] = "ts-jest/presets/default";
|
|
8
|
+
JestPresetNames["jsWithTs"] = "ts-jest/presets/js-with-ts";
|
|
9
|
+
JestPresetNames["jsWIthBabel"] = "ts-jest/presets/js-with-babel";
|
|
10
|
+
})(JestPresetNames || (exports.JestPresetNames = JestPresetNames = {}));
|
|
4
11
|
const definePreset = (fullName) => ({
|
|
5
12
|
fullName,
|
|
6
13
|
get name() {
|
|
@@ -27,15 +34,15 @@ const definePreset = (fullName) => ({
|
|
|
27
34
|
return `const { ${this.jsVarName}: ${varName} } = require('ts-jest/presets')`;
|
|
28
35
|
},
|
|
29
36
|
get isDefault() {
|
|
30
|
-
return fullName ===
|
|
37
|
+
return fullName === JestPresetNames.default;
|
|
31
38
|
},
|
|
32
39
|
});
|
|
33
40
|
/** @internal */
|
|
34
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
42
|
exports.allPresets = {};
|
|
36
43
|
/** @internal */
|
|
37
|
-
exports.defaults = (exports.allPresets[
|
|
44
|
+
exports.defaults = (exports.allPresets[JestPresetNames.default] = definePreset(JestPresetNames.default));
|
|
38
45
|
/** @internal */
|
|
39
|
-
exports.jsWithTs = (exports.allPresets[
|
|
46
|
+
exports.jsWithTs = (exports.allPresets[JestPresetNames.jsWithTs] = definePreset(JestPresetNames.jsWithTs));
|
|
40
47
|
/** @internal */
|
|
41
|
-
exports.jsWIthBabel = (exports.allPresets[
|
|
48
|
+
exports.jsWIthBabel = (exports.allPresets[JestPresetNames.jsWIthBabel] = definePreset(JestPresetNames.jsWIthBabel));
|
|
@@ -14,7 +14,7 @@ const pathsToModuleNameMapper = (mapping, { prefix = '', useESM = false } = {})
|
|
|
14
14
|
const toPaths = mapping[fromPath];
|
|
15
15
|
// check that we have only one target path
|
|
16
16
|
if (toPaths.length === 0) {
|
|
17
|
-
logger.warn((0, messages_1.interpolate)(
|
|
17
|
+
logger.warn((0, messages_1.interpolate)(messages_1.Errors.NotMappingPathWithEmptyMap, { path: fromPath }));
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
// split with '*'
|
|
@@ -41,7 +41,7 @@ const pathsToModuleNameMapper = (mapping, { prefix = '', useESM = false } = {})
|
|
|
41
41
|
jestMap[cjsPattern] = paths.length === 1 ? paths[0] : paths;
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
logger.warn((0, messages_1.interpolate)(
|
|
44
|
+
logger.warn((0, messages_1.interpolate)(messages_1.Errors.NotMappingMultiStarPath, { path: fromPath }));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
if (useESM) {
|
|
@@ -15,7 +15,7 @@ const messages_1 = require("../../utils/messages");
|
|
|
15
15
|
const compiler_utils_1 = require("./compiler-utils");
|
|
16
16
|
const assertCompilerOptionsWithJestTransformMode = (compilerOptions, isEsmMode, logger) => {
|
|
17
17
|
if (isEsmMode && compilerOptions.module === typescript_1.default.ModuleKind.CommonJS) {
|
|
18
|
-
logger.error(
|
|
18
|
+
logger.error(messages_1.Errors.InvalidModuleKindForEsm);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
class TsCompiler {
|
|
@@ -285,7 +285,7 @@ class TsCompiler {
|
|
|
285
285
|
this._previousCompiledModuleKind = currentModuleKind;
|
|
286
286
|
if (this._languageService) {
|
|
287
287
|
if (constants_1.JS_JSX_REGEX.test(fileName) && !this._compilerOptions.allowJs) {
|
|
288
|
-
this._logger.warn({ fileName: fileName }, (0, messages_1.interpolate)(
|
|
288
|
+
this._logger.warn({ fileName: fileName }, (0, messages_1.interpolate)(messages_1.Errors.GotJsFileButAllowJsFalse, { path: fileName }));
|
|
289
289
|
return {
|
|
290
290
|
code: fileContent,
|
|
291
291
|
};
|
|
@@ -331,10 +331,10 @@ class TsCompiler {
|
|
|
331
331
|
}
|
|
332
332
|
if (output.emitSkipped) {
|
|
333
333
|
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
|
334
|
-
throw new Error((0, messages_1.interpolate)(
|
|
334
|
+
throw new Error((0, messages_1.interpolate)(messages_1.Errors.CannotProcessFile, { file: fileName }));
|
|
335
335
|
}
|
|
336
336
|
else {
|
|
337
|
-
this._logger.warn((0, messages_1.interpolate)(
|
|
337
|
+
this._logger.warn((0, messages_1.interpolate)(messages_1.Errors.CannotProcessFileReturnOriginal, { file: fileName }));
|
|
338
338
|
return {
|
|
339
339
|
code: fileContent,
|
|
340
340
|
};
|
|
@@ -342,7 +342,7 @@ class TsCompiler {
|
|
|
342
342
|
}
|
|
343
343
|
// Throw an error when requiring `.d.ts` files.
|
|
344
344
|
if (!output.outputFiles.length) {
|
|
345
|
-
throw new TypeError((0, messages_1.interpolate)(
|
|
345
|
+
throw new TypeError((0, messages_1.interpolate)(messages_1.Errors.UnableToRequireDefinitionFile, {
|
|
346
346
|
file: (0, path_1.basename)(fileName),
|
|
347
347
|
}));
|
|
348
348
|
}
|
|
@@ -483,7 +483,13 @@ class TsCompiler {
|
|
|
483
483
|
getCompilationSettings: () => this._compilerOptions,
|
|
484
484
|
getDefaultLibFileName: () => this._ts.getDefaultLibFilePath(this._compilerOptions),
|
|
485
485
|
getCustomTransformers: () => this._makeTransformers(this.configSet.resolvedTransformers),
|
|
486
|
-
resolveModuleNames: (moduleNames, containingFile) =>
|
|
486
|
+
resolveModuleNames: (moduleNames, containingFile) => {
|
|
487
|
+
if (moduleNames.length === 0) {
|
|
488
|
+
return [];
|
|
489
|
+
}
|
|
490
|
+
const resolutionMode = this._getResolutionMode(containingFile);
|
|
491
|
+
return moduleNames.map((moduleName) => this._resolveModuleName(moduleName, containingFile, resolutionMode).resolvedModule);
|
|
492
|
+
},
|
|
487
493
|
};
|
|
488
494
|
this._logger.debug('created language service');
|
|
489
495
|
this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry(this._ts.sys.useCaseSensitiveFileNames, this.configSet.cwd));
|
|
@@ -506,10 +512,14 @@ class TsCompiler {
|
|
|
506
512
|
* @internal
|
|
507
513
|
*/
|
|
508
514
|
_getImportedModulePaths(resolvedFileContent, containingFile) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
515
|
+
const importedFiles = this._ts.preProcessFile(resolvedFileContent, true, true).importedFiles;
|
|
516
|
+
if (importedFiles.length === 0) {
|
|
517
|
+
return [];
|
|
518
|
+
}
|
|
519
|
+
const resolutionMode = this._getResolutionMode(containingFile);
|
|
520
|
+
return importedFiles
|
|
521
|
+
.map((importedFile) => {
|
|
522
|
+
const { resolvedModule } = this._resolveModuleName(importedFile.fileName, containingFile, resolutionMode);
|
|
513
523
|
/* istanbul ignore next already covered */
|
|
514
524
|
const resolvedFileName = resolvedModule?.resolvedFileName;
|
|
515
525
|
/* istanbul ignore next already covered */
|
|
@@ -520,13 +530,25 @@ class TsCompiler {
|
|
|
520
530
|
/**
|
|
521
531
|
* @internal
|
|
522
532
|
*/
|
|
523
|
-
|
|
533
|
+
_getResolutionMode(containingFile) {
|
|
524
534
|
const getImpliedNodeFormat = this._ts.getImpliedNodeFormatForFile;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
535
|
+
if (typeof getImpliedNodeFormat !== 'function') {
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
// @ts-expect-error internal TypeScript API
|
|
539
|
+
const moduleResolution = this._ts.getEmitModuleResolutionKind(this._compilerOptions);
|
|
540
|
+
const { Classic, Node10, NodeJs } = this._ts.ModuleResolutionKind;
|
|
541
|
+
if (moduleResolution === (Node10 ?? NodeJs) || moduleResolution === Classic) {
|
|
542
|
+
return undefined;
|
|
543
|
+
}
|
|
544
|
+
return getImpliedNodeFormat(containingFile, this._moduleResolutionCache?.getPackageJsonInfoCache?.(),
|
|
545
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
546
|
+
this._moduleResolutionHost, this._compilerOptions);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* @internal
|
|
550
|
+
*/
|
|
551
|
+
_resolveModuleName(moduleNameToResolve, containingFile, resolutionMode) {
|
|
530
552
|
return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions,
|
|
531
553
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
532
554
|
this._moduleResolutionHost,
|
|
@@ -200,7 +200,7 @@ class ConfigSet {
|
|
|
200
200
|
const tsJestCfg = this._jestCfg.globals && this._jestCfg.globals['ts-jest'];
|
|
201
201
|
const options = tsJestCfg ?? Object.create(null);
|
|
202
202
|
// compiler module
|
|
203
|
-
this.compilerModule = importer_1.importer.typescript(
|
|
203
|
+
this.compilerModule = importer_1.importer.typescript(messages_1.ImportReasons.TsJest, options.compiler ?? 'typescript');
|
|
204
204
|
this.logger.debug({ compilerModule: this.compilerModule }, 'normalized compiler module config via ts-jest option');
|
|
205
205
|
this._setupConfigSet(options);
|
|
206
206
|
this._matchablePatterns = [...this._jestCfg.testMatch, ...this._jestCfg.testRegex].filter((pattern) =>
|
|
@@ -217,12 +217,12 @@ class ConfigSet {
|
|
|
217
217
|
if (options.isolatedModules) {
|
|
218
218
|
this.parsedTsConfig.options.isolatedModules = true;
|
|
219
219
|
if (this.tsconfigFilePath) {
|
|
220
|
-
this.logger.warn((0, messages_1.interpolate)(
|
|
220
|
+
this.logger.warn((0, messages_1.interpolate)(messages_1.Deprecations.IsolatedModulesWithTsconfigPath, {
|
|
221
221
|
tsconfigFilePath: this.tsconfigFilePath,
|
|
222
222
|
}));
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
|
-
this.logger.warn(
|
|
225
|
+
this.logger.warn(messages_1.Deprecations.IsolatedModulesWithoutTsconfigPath);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
this.isolatedModules = this.parsedTsConfig.options.isolatedModules ?? false;
|
|
@@ -279,7 +279,7 @@ class ConfigSet {
|
|
|
279
279
|
}
|
|
280
280
|
this.logger.debug({ babelConfig: this.babelConfig }, 'normalized babel config via ts-jest option');
|
|
281
281
|
this.babelJestTransformer = importer_1.importer
|
|
282
|
-
.babelJest(
|
|
282
|
+
.babelJest(messages_1.ImportReasons.BabelJest)
|
|
283
283
|
.createTransformer(this.babelConfig);
|
|
284
284
|
this.logger.debug('created babel-jest transformer');
|
|
285
285
|
}
|
|
@@ -337,7 +337,7 @@ class ConfigSet {
|
|
|
337
337
|
let transformerFunc;
|
|
338
338
|
if ((0, path_1.extname)(transformerPath) === '.ts') {
|
|
339
339
|
const compiledTransformer = importer_1.importer
|
|
340
|
-
.esBuild(
|
|
340
|
+
.esBuild(messages_1.ImportReasons.EsBuild)
|
|
341
341
|
.transformSync((0, fs_1.readFileSync)(transformerPath, 'utf-8'), {
|
|
342
342
|
loader: 'ts',
|
|
343
343
|
format: 'cjs',
|
|
@@ -349,10 +349,10 @@ class ConfigSet {
|
|
|
349
349
|
transformerFunc = require(transformerPath);
|
|
350
350
|
}
|
|
351
351
|
if (!transformerFunc.version) {
|
|
352
|
-
this.logger.warn(
|
|
352
|
+
this.logger.warn(messages_1.Errors.MissingTransformerVersion, { file: transformerPath });
|
|
353
353
|
}
|
|
354
354
|
if (!transformerFunc.name) {
|
|
355
|
-
this.logger.warn(
|
|
355
|
+
this.logger.warn(messages_1.Errors.MissingTransformerName, { file: transformerPath });
|
|
356
356
|
}
|
|
357
357
|
return transformerFunc;
|
|
358
358
|
};
|
|
@@ -449,7 +449,7 @@ class ConfigSet {
|
|
|
449
449
|
!(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
|
|
450
450
|
result.errors.push({
|
|
451
451
|
code: utils_1.TsJestDiagnosticCodes.ConfigModuleOption,
|
|
452
|
-
messageText:
|
|
452
|
+
messageText: messages_1.Errors.ConfigNoModuleInterop,
|
|
453
453
|
category: this.compilerModule.DiagnosticCategory.Message,
|
|
454
454
|
file: undefined,
|
|
455
455
|
start: undefined,
|
|
@@ -488,7 +488,7 @@ class ConfigSet {
|
|
|
488
488
|
!this.babelConfig &&
|
|
489
489
|
nodeJsVer.startsWith('v12') &&
|
|
490
490
|
compilationTarget > this.compilerModule.ScriptTarget.ES2019) {
|
|
491
|
-
const message = (0, messages_1.interpolate)(
|
|
491
|
+
const message = (0, messages_1.interpolate)(messages_1.Errors.MismatchNodeTargetMapping, {
|
|
492
492
|
nodeJsVer: process.version,
|
|
493
493
|
compilationTarget: TARGET_TO_VERSION_MAPPING[compilationTarget],
|
|
494
494
|
});
|
|
@@ -612,7 +612,7 @@ class ConfigSet {
|
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
if (throwIfMissing && !(0, fs_1.existsSync)(path)) {
|
|
615
|
-
throw new Error((0, messages_1.interpolate)(
|
|
615
|
+
throw new Error((0, messages_1.interpolate)(messages_1.Errors.FileNotFound, { inputPath, resolvedPath: path }));
|
|
616
616
|
}
|
|
617
617
|
this.logger.debug({ fromPath: inputPath, toPath: path }, 'resolved path from', inputPath, 'to', path);
|
|
618
618
|
return path;
|
|
@@ -79,7 +79,7 @@ class TsJestTransformer {
|
|
|
79
79
|
// create the new record in the index
|
|
80
80
|
this._logger.info('no matching config-set found, creating a new one');
|
|
81
81
|
if (config.globals?.['ts-jest']) {
|
|
82
|
-
this._logger.warn(
|
|
82
|
+
this._logger.warn(messages_1.Deprecations.GlobalsTsJestConfigOption);
|
|
83
83
|
}
|
|
84
84
|
const jestGlobalsConfig = config.globals ?? {};
|
|
85
85
|
const tsJestGlobalsConfig = jestGlobalsConfig['ts-jest'] ?? {};
|
|
@@ -215,7 +215,7 @@ class TsJestTransformer {
|
|
|
215
215
|
// we should not get called for files with other extension than js[x], ts[x] and d.ts,
|
|
216
216
|
// TypeScript will bail if we try to compile, and if it was to call babel, users can
|
|
217
217
|
// define the transform value with `babel-jest` for this extension instead
|
|
218
|
-
const message = babelJest ?
|
|
218
|
+
const message = babelJest ? messages_1.Errors.GotUnknownFileTypeWithBabel : messages_1.Errors.GotUnknownFileTypeWithoutBabel;
|
|
219
219
|
this._logger.warn({ fileName: sourcePath }, (0, messages_1.interpolate)(message, { path: sourcePath }));
|
|
220
220
|
result = {
|
|
221
221
|
code: sourceText,
|
package/dist/utils/backports.js
CHANGED
|
@@ -17,7 +17,7 @@ const backportJestConfig = (logger, config) => {
|
|
|
17
17
|
let hadWarnings = false;
|
|
18
18
|
const warnConfig = (oldPath, newPath, note) => {
|
|
19
19
|
hadWarnings = true;
|
|
20
|
-
logger.warn(context, (0, messages_1.interpolate)(note ?
|
|
20
|
+
logger.warn(context, (0, messages_1.interpolate)(note ? messages_1.Deprecations.ConfigOptionWithNote : messages_1.Deprecations.ConfigOption, {
|
|
21
21
|
oldPath,
|
|
22
22
|
newPath,
|
|
23
23
|
note,
|
|
@@ -69,7 +69,7 @@ const backportJestConfig = (logger, config) => {
|
|
|
69
69
|
delete tsJest.enableTsDiagnostics;
|
|
70
70
|
}
|
|
71
71
|
if ('useBabelrc' in tsJest) {
|
|
72
|
-
warnConfig('globals.ts-jest.useBabelrc', 'globals.ts-jest.babelConfig',
|
|
72
|
+
warnConfig('globals.ts-jest.useBabelrc', 'globals.ts-jest.babelConfig', messages_1.Deprecations.ConfigOptionUseBabelRcNote);
|
|
73
73
|
if (tsJest.useBabelrc != null) {
|
|
74
74
|
mergeTsJest.babelConfig = tsJest.useBabelrc ? true : {};
|
|
75
75
|
}
|
|
@@ -109,7 +109,7 @@ const backportTsJestDebugEnvVar = (logger) => {
|
|
|
109
109
|
if (shouldLog) {
|
|
110
110
|
process.env.TS_JEST_LOG = 'ts-jest.log,stderr:warn';
|
|
111
111
|
}
|
|
112
|
-
logger.warn(context, (0, messages_1.interpolate)(
|
|
112
|
+
logger.warn(context, (0, messages_1.interpolate)(messages_1.Deprecations.EnvVar, {
|
|
113
113
|
old: 'TS_JEST_DEBUG',
|
|
114
114
|
new: 'TS_JEST_LOG',
|
|
115
115
|
}));
|
package/dist/utils/importer.js
CHANGED
|
@@ -32,7 +32,7 @@ class Importer {
|
|
|
32
32
|
typeof compilerModule.parseJsonConfigFileContent === 'function' &&
|
|
33
33
|
typeof compilerModule.transpileModule === 'function';
|
|
34
34
|
if (!hasRequiredCompilerApi) {
|
|
35
|
-
throw new Error((0, messages_1.interpolate)(
|
|
35
|
+
throw new Error((0, messages_1.interpolate)(messages_1.Errors.TypeScriptCompilerApiUnavailable, {
|
|
36
36
|
module: which,
|
|
37
37
|
version: compilerModule.version ?? 'unknown',
|
|
38
38
|
}));
|
|
@@ -91,10 +91,10 @@ class Importer {
|
|
|
91
91
|
if (!res.error)
|
|
92
92
|
return res.exports;
|
|
93
93
|
// it could not load because of a failure while importing, but it exists
|
|
94
|
-
throw new Error((0, messages_1.interpolate)(
|
|
94
|
+
throw new Error((0, messages_1.interpolate)(messages_1.Errors.LoadingModuleFailed, { module: res.given, error: res.error.message }));
|
|
95
95
|
}
|
|
96
96
|
// if it couldn't load, build a nice error message so the user can fix it by himself
|
|
97
|
-
const msg = alternatives.length ?
|
|
97
|
+
const msg = alternatives.length ? messages_1.Errors.UnableToLoadAnyModule : messages_1.Errors.UnableToLoadOneModule;
|
|
98
98
|
const loadModule = [moduleName, ...alternatives].map((m) => `"${m}"`).join(', ');
|
|
99
99
|
if (typeof installTip === 'string') {
|
|
100
100
|
installTip = [{ module: installTip, label: `install "${installTip}"` }];
|
package/dist/utils/messages.js
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Helps = void 0;
|
|
3
|
+
exports.ImportReasons = exports.Deprecations = exports.Helps = exports.Errors = void 0;
|
|
4
4
|
exports.interpolate = interpolate;
|
|
5
5
|
const diagnostics_1 = require("./diagnostics");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
var Errors;
|
|
10
|
+
(function (Errors) {
|
|
11
|
+
Errors["LoadingModuleFailed"] = "Loading module {{module}} failed with error: {{error}}";
|
|
12
|
+
Errors["TypeScriptCompilerApiUnavailable"] = "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.";
|
|
13
|
+
Errors["UnableToLoadOneModule"] = "Unable to load the module {{module}}. {{reason}} To fix it:\n{{fix}}";
|
|
14
|
+
Errors["UnableToLoadAnyModule"] = "Unable to load any of these modules: {{module}}. {{reason}}. To fix it:\n{{fix}}";
|
|
15
|
+
Errors["UnableToRequireDefinitionFile"] = "Unable to require `.d.ts` file for file: {{file}}.\nThis is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `{{file}}`.";
|
|
16
|
+
Errors["FileNotFound"] = "File not found: {{inputPath}} (resolved as: {{resolvedPath}})";
|
|
17
|
+
Errors["UnableToCompileTypeScript"] = "{{diagnostics}}";
|
|
18
|
+
Errors["NotMappingMultiStarPath"] = "Not mapping \"{{path}}\" because it has more than one star (`*`).";
|
|
19
|
+
Errors["NotMappingPathWithEmptyMap"] = "Not mapping \"{{path}}\" because it has no target.";
|
|
20
|
+
Errors["GotJsFileButAllowJsFalse"] = "Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore";
|
|
21
|
+
Errors["GotUnknownFileTypeWithoutBabel"] = "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.";
|
|
22
|
+
Errors["GotUnknownFileTypeWithBabel"] = "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files.";
|
|
23
|
+
Errors["ConfigNoModuleInterop"] = "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.";
|
|
24
|
+
Errors["MismatchNodeTargetMapping"] = "There is a mismatch between your NodeJs version {{nodeJsVer}} and your TypeScript target {{compilationTarget}}. This might lead to some unexpected errors when running tests with `ts-jest`. To fix this, you can check https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping";
|
|
25
|
+
Errors["CannotProcessFileReturnOriginal"] = "Unable to process '{{file}}', falling back to original file content. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation or make sure that `outDir` in your tsconfig is neither `''` or `'.'`";
|
|
26
|
+
Errors["CannotProcessFile"] = "Unable to process '{{file}}', please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to inform `ts-jest` to transform {{file}}";
|
|
27
|
+
Errors["MissingTransformerName"] = "The AST transformer {{file}} must have an `export const name = <your_transformer_name>`";
|
|
28
|
+
Errors["MissingTransformerVersion"] = "The AST transformer {{file}} must have an `export const version = <your_transformer_version>`";
|
|
29
|
+
Errors["InvalidModuleKindForEsm"] = "The current compiler option \"module\" value is not suitable for Jest ESM mode. Please either use ES module kinds or Node16/NodeNext module kinds with \"type: module\" in package.json";
|
|
30
|
+
})(Errors || (exports.Errors = Errors = {}));
|
|
6
31
|
/**
|
|
7
32
|
* @internal
|
|
8
33
|
*/
|
|
@@ -11,6 +36,29 @@ exports.Helps = {
|
|
|
11
36
|
MigrateConfigUsingCLI: 'Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.',
|
|
12
37
|
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
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
var Deprecations;
|
|
43
|
+
(function (Deprecations) {
|
|
44
|
+
Deprecations["EnvVar"] = "Using env. var \"{{old}}\" is deprecated, use \"{{new}}\" instead.";
|
|
45
|
+
Deprecations["ConfigOption"] = "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.";
|
|
46
|
+
Deprecations["ConfigOptionWithNote"] = "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.\n \u21B3 {{note}}";
|
|
47
|
+
Deprecations["ConfigOptionUseBabelRcNote"] = "See `babel-jest` related issue: https://github.com/facebook/jest/issues/3845";
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member
|
|
49
|
+
Deprecations["GlobalsTsJestConfigOption"] = "Define `ts-jest` config under `globals` is deprecated. Please do\ntransform: {\n <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],\n},\nSee more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced";
|
|
50
|
+
Deprecations["IsolatedModulesWithTsconfigPath"] = "\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 ";
|
|
51
|
+
Deprecations["IsolatedModulesWithoutTsconfigPath"] = "\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 ";
|
|
52
|
+
})(Deprecations || (exports.Deprecations = Deprecations = {}));
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
var ImportReasons;
|
|
57
|
+
(function (ImportReasons) {
|
|
58
|
+
ImportReasons["TsJest"] = "Using \"ts-jest\" requires this package to be installed.";
|
|
59
|
+
ImportReasons["BabelJest"] = "Using \"babel-jest\" requires this package to be installed.";
|
|
60
|
+
ImportReasons["EsBuild"] = "Using \"esbuild\" requires this package to be installed.";
|
|
61
|
+
})(ImportReasons || (exports.ImportReasons = ImportReasons = {}));
|
|
14
62
|
/**
|
|
15
63
|
* @internal
|
|
16
64
|
*/
|
package/dist/utils/ts-error.js
CHANGED
|
@@ -20,7 +20,7 @@ class TSError extends make_error_1.BaseError {
|
|
|
20
20
|
diagnosticCodes;
|
|
21
21
|
name = 'TSError';
|
|
22
22
|
constructor(diagnosticText, diagnosticCodes) {
|
|
23
|
-
super((0, messages_1.interpolate)(
|
|
23
|
+
super((0, messages_1.interpolate)(messages_1.Errors.UnableToCompileTypeScript, {
|
|
24
24
|
diagnostics: diagnosticText.trim(),
|
|
25
25
|
}));
|
|
26
26
|
this.diagnosticText = diagnosticText;
|
package/npm-view.err
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
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
2
|
npm error code E404
|
|
3
|
-
npm error 404 No match found for version 29.4.
|
|
3
|
+
npm error 404 No match found for version 29.4.14
|
|
4
4
|
npm error 404
|
|
5
|
-
npm error 404 The requested resource 'ts-jest@29.4.
|
|
5
|
+
npm error 404 The requested resource 'ts-jest@29.4.14' could not be found or you do not have permission to access it.
|
|
6
6
|
npm error 404
|
|
7
7
|
npm error 404 Note that you can also install from a
|
|
8
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-
|
|
9
|
+
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2026-09-25T10_37_31_775Z-debug-0.log
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/ts-jest",
|
|
3
|
-
"version": "29.4.
|
|
3
|
+
"version": "29.4.14-depup.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"build": "tsc -p tsconfig.build.json",
|
|
14
14
|
"postbuild": "node scripts/post-build.js",
|
|
15
15
|
"test": "jest -c=jest.config.ts",
|
|
16
|
-
"test-e2e
|
|
17
|
-
"test-e2e-esm": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-e2e-esm.config.ts --no-cache",
|
|
16
|
+
"test-e2e": "jest -c=e2e/jest.config.cts",
|
|
18
17
|
"test-examples": "node scripts/test-examples.js",
|
|
19
18
|
"lint": "eslint .",
|
|
20
19
|
"lint-fix": "eslint --fix .",
|
|
@@ -62,11 +61,11 @@
|
|
|
62
61
|
"lodash.memoize": "^4.1.2",
|
|
63
62
|
"make-error": "^1.3.6",
|
|
64
63
|
"semver": "^7.8.5",
|
|
65
|
-
"type-fest": "^5.
|
|
64
|
+
"type-fest": "^5.10.0",
|
|
66
65
|
"yargs-parser": "^22.0.0"
|
|
67
66
|
},
|
|
68
67
|
"peerDependencies": {
|
|
69
|
-
"@babel/core": ">=7.0.0-beta.0 <
|
|
68
|
+
"@babel/core": ">=7.0.0-beta.0 <9",
|
|
70
69
|
"@jest/transform": "^29.0.0 || ^30.0.0",
|
|
71
70
|
"@jest/types": "^29.0.0 || ^30.0.0",
|
|
72
71
|
"babel-jest": "^29.0.0 || ^30.0.0",
|
|
@@ -98,11 +97,11 @@
|
|
|
98
97
|
"@commitlint/cli": "^19.8.1",
|
|
99
98
|
"@commitlint/config-angular": "^19.8.1",
|
|
100
99
|
"@eslint/compat": "^1.4.1",
|
|
101
|
-
"@eslint/eslintrc": "^3.3.
|
|
100
|
+
"@eslint/eslintrc": "^3.3.7",
|
|
102
101
|
"@eslint/js": "^9.39.5",
|
|
103
|
-
"@jest/globals": "^30.
|
|
104
|
-
"@jest/transform": "^30.
|
|
105
|
-
"@jest/types": "^30.
|
|
102
|
+
"@jest/globals": "^30.5.2",
|
|
103
|
+
"@jest/transform": "^30.5.2",
|
|
104
|
+
"@jest/types": "^30.5.1",
|
|
106
105
|
"@types/babel__core": "^7.20.5",
|
|
107
106
|
"@types/fs-extra": "^11.0.4",
|
|
108
107
|
"@types/jest": "^29.5.14",
|
|
@@ -112,15 +111,13 @@
|
|
|
112
111
|
"@types/lodash.set": "^4.3.9",
|
|
113
112
|
"@types/micromatch": "^4.0.10",
|
|
114
113
|
"@types/node": "20.19.43",
|
|
115
|
-
"@types/semver": "^7.
|
|
114
|
+
"@types/semver": "^7.8.0",
|
|
116
115
|
"@types/yargs": "^17.0.35",
|
|
117
116
|
"@types/yargs-parser": "21.0.3",
|
|
118
|
-
"
|
|
119
|
-
"@typescript-eslint/parser": "^8.64.0",
|
|
120
|
-
"babel-jest": "^30.4.1",
|
|
117
|
+
"babel-jest": "^30.5.2",
|
|
121
118
|
"conventional-changelog-angular": "^8.3.1",
|
|
122
119
|
"conventional-changelog": "^7.2.1",
|
|
123
|
-
"esbuild": "~0.28.
|
|
120
|
+
"esbuild": "~0.28.2",
|
|
124
121
|
"eslint": "^9.39.5",
|
|
125
122
|
"eslint-config-prettier": "^10.1.8",
|
|
126
123
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -129,18 +126,18 @@
|
|
|
129
126
|
"eslint-plugin-prettier": "^4.2.5",
|
|
130
127
|
"execa": "5.1.1",
|
|
131
128
|
"fast-glob": "^3.3.3",
|
|
132
|
-
"fs-extra": "^11.
|
|
129
|
+
"fs-extra": "^11.4.0",
|
|
133
130
|
"globals": "^16.5.0",
|
|
134
131
|
"husky": "^9.1.7",
|
|
135
|
-
"jest": "^30.
|
|
136
|
-
"js-yaml": "^4.3.
|
|
132
|
+
"jest": "^30.5.2",
|
|
133
|
+
"js-yaml": "^4.3.2",
|
|
137
134
|
"lint-staged": "^15.5.2",
|
|
138
|
-
"memfs": "^4.
|
|
135
|
+
"memfs": "^4.78.1",
|
|
139
136
|
"prettier": "^2.8.8",
|
|
140
137
|
"rimraf": "^5.0.10",
|
|
141
138
|
"ts-node": "^10.9.2",
|
|
142
139
|
"typescript": "~5.9.3",
|
|
143
|
-
"typescript-eslint": "^8.
|
|
140
|
+
"typescript-eslint": "^8.70.1"
|
|
144
141
|
},
|
|
145
142
|
"engines": {
|
|
146
143
|
"node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
|
|
@@ -149,7 +146,7 @@
|
|
|
149
146
|
"changes": {
|
|
150
147
|
"type-fest": {
|
|
151
148
|
"from": "^4.41.0",
|
|
152
|
-
"to": "^5.
|
|
149
|
+
"to": "^5.10.0"
|
|
153
150
|
},
|
|
154
151
|
"yargs-parser": {
|
|
155
152
|
"from": "^21.1.1",
|
|
@@ -158,8 +155,8 @@
|
|
|
158
155
|
},
|
|
159
156
|
"depsUpdated": 2,
|
|
160
157
|
"originalPackage": "ts-jest",
|
|
161
|
-
"originalVersion": "29.4.
|
|
162
|
-
"processedAt": "2026-
|
|
158
|
+
"originalVersion": "29.4.14",
|
|
159
|
+
"processedAt": "2026-09-27T01:04:44.063Z",
|
|
163
160
|
"smokeTest": "passed"
|
|
164
161
|
}
|
|
165
162
|
}
|