@depup/ts-jest 29.4.9-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 +68 -1
- 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.d.ts +108 -0
- package/dist/legacy/compiler/ts-compiler.js +212 -23
- package/dist/legacy/config/config-set.js +10 -10
- package/dist/legacy/ts-jest-transformer.js +7 -4
- package/dist/transformers/hoist-jest.js +11 -4
- package/dist/utils/backports.js +3 -3
- package/dist/utils/importer.js +13 -3
- package/dist/utils/messages.js +49 -1
- package/dist/utils/ts-error.js +1 -1
- package/npm-view.err +9 -0
- package/package.json +25 -28
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
44df70f98f3cf89af95cce14fa68674b52acbfd3
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
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
|
+
|
|
20
|
+
## [29.4.12](https://github.com/kulshekhar/ts-jest/compare/v29.4.11...v29.4.12) (2026-07-22)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **compiler:** support TypeScript 7 projects through compatibility aliases ([#5386](https://github.com/kulshekhar/ts-jest/pull/5386))
|
|
26
|
+
|
|
27
|
+
## [29.4.11](https://github.com/kulshekhar/ts-jest/compare/v29.4.10...v29.4.11) (2026-05-21)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* 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)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [29.4.10](https://github.com/kulshekhar/ts-jest/compare/v29.4.9...v29.4.10) (2026-05-18)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* pass `resolutionMode` to `ts.resolveModuleName` for hybrid module support ([b557a85](https://github.com/kulshekhar/ts-jest/commit/b557a85f85c3fd34523ec3a15293afbdc9dea83c))
|
|
42
|
+
* rebuild `Program` when consecutive compiles need different module kinds ([a82a2b3](https://github.com/kulshekhar/ts-jest/commit/a82a2b32c4987a5249fd5284283117dd2fa3be47)), closes [#4774](https://github.com/kulshekhar/ts-jest/issues/4774)
|
|
43
|
+
* respect tsconfig `moduleResolution` instead of forcing `Node10` ([1bffffc](https://github.com/kulshekhar/ts-jest/commit/1bffffc667557c173ae0c1f93dd436920775dac4))
|
|
44
|
+
* **transformer:** transpile `mjs` files from `node_modules` for CJS mode ([96d025d](https://github.com/kulshekhar/ts-jest/commit/96d025dd912ea2bceb18b67d2d509ada7a756d9d))
|
|
45
|
+
* **transformer:** use a consistent comparator in hoist-jest sortStatements ([8a8fd2f](https://github.com/kulshekhar/ts-jest/commit/8a8fd2fb8446655bba18367db9306a1089490e62))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [29.4.9](https://github.com/kulshekhar/ts-jest/compare/v29.4.8...v29.4.9) (2026-04-01)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* use correct registry for npm OIDC trusted publishing ([f8a9cc9](https://github.com/kulshekhar/ts-jest/commit/f8a9cc9892))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## [29.4.8](https://github.com/kulshekhar/ts-jest/compare/v29.4.7...v29.4.8) (2026-04-01)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* wrong published assets
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
1
67
|
## [29.4.7](https://github.com/kulshekhar/ts-jest/compare/v29.4.6...v29.4.7) (2026-04-01)
|
|
2
68
|
|
|
3
69
|
|
|
@@ -5,6 +71,8 @@
|
|
|
5
71
|
|
|
6
72
|
* support TypeScript v6 ([eda517d](https://github.com/kulshekhar/ts-jest/commit/eda517d226389317d99572887d3c1aa93c81be87))
|
|
7
73
|
|
|
74
|
+
|
|
75
|
+
|
|
8
76
|
## [29.4.6](https://github.com/kulshekhar/ts-jest/compare/v29.4.5...v29.4.6) (2025-12-01)
|
|
9
77
|
|
|
10
78
|
|
|
@@ -2029,4 +2097,3 @@ For example
|
|
|
2029
2097
|
# 0.0.0 (2016-08-30)
|
|
2030
2098
|
|
|
2031
2099
|
|
|
2032
|
-
|
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) {
|
|
@@ -20,8 +20,116 @@ export declare class TsCompiler implements TsCompilerInstance {
|
|
|
20
20
|
program: Program | undefined;
|
|
21
21
|
constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
|
|
22
22
|
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Apply ts-jest's runtime fixups on top of the user's compiler options before
|
|
25
|
+
* handing them to the language service or transpiler.
|
|
26
|
+
*
|
|
27
|
+
* Two compiler-options now flow through dedicated helpers so the produced
|
|
28
|
+
* options are always a TypeScript-valid combination:
|
|
29
|
+
*
|
|
30
|
+
* - `moduleResolution` is delegated to `resolveCompatibleModuleResolution`,
|
|
31
|
+
* which preserves the user's value when it is valid alongside the
|
|
32
|
+
* `module` ts-jest forces at runtime (CommonJS on the CJS path, or
|
|
33
|
+
* ESNext / the user's original `module` on the ESM path) and otherwise
|
|
34
|
+
* substitutes a TypeScript-valid alternative. When the user has not set
|
|
35
|
+
* a value the historical Node10 default is kept, so unchanged tsconfigs
|
|
36
|
+
* see the exact same resolved options as before.
|
|
37
|
+
*
|
|
38
|
+
* - `customConditions` is delegated to `preserveCustomConditionsIfCompatible`,
|
|
39
|
+
* which keeps the user's value only when the resolved
|
|
40
|
+
* `moduleResolution` supports it (`Bundler` / `Node16` / `NodeNext`)
|
|
41
|
+
* and clears it otherwise. The pre-#4198 code unconditionally cleared
|
|
42
|
+
* this option because the hardcoded `Node10` override always made it
|
|
43
|
+
* incompatible; that is no longer true.
|
|
44
|
+
*
|
|
45
|
+
* @see https://github.com/kulshekhar/ts-jest/issues/4198
|
|
46
|
+
*/
|
|
23
47
|
private fixupCompilerOptionsForModuleKind;
|
|
48
|
+
/**
|
|
49
|
+
* Pick a `moduleResolution` value that is valid alongside the `module` ts-jest
|
|
50
|
+
* forces at runtime. Closes #4198: previously this was hardcoded to Node10 and
|
|
51
|
+
* silently overrode whatever the user set in tsconfig, even when the user value
|
|
52
|
+
* would have been valid (e.g. Bundler with module: ESNext, Classic with CommonJS).
|
|
53
|
+
*
|
|
54
|
+
* Substitution rules — each tied to a specific TypeScript diagnostic that the
|
|
55
|
+
* resulting combination would otherwise raise. The "Bundler-compatible" set is
|
|
56
|
+
* the one defined by `isBundlerCompatibleModuleKind` (ES2015 / ES2020 / ES2022
|
|
57
|
+
* / ESNext / Preserve); everything else (CommonJS / AMD / UMD / System / None)
|
|
58
|
+
* is treated as Bundler-incompatible across the full supported TS range.
|
|
59
|
+
*
|
|
60
|
+
* - Node16 / NodeNext require `module: Node16` or `module: NodeNext` (TS5110).
|
|
61
|
+
* ts-jest never emits those module kinds, so these user-supplied values are
|
|
62
|
+
* substituted: to Bundler when the forced module is in the
|
|
63
|
+
* Bundler-compatible set, or to Node10 otherwise. (Pairing Bundler with a
|
|
64
|
+
* non-ES module raises TS5095, and Node10 is the only kind that has been
|
|
65
|
+
* valid with non-ES modules across every TypeScript version ts-jest
|
|
66
|
+
* supports.)
|
|
67
|
+
*
|
|
68
|
+
* - User-supplied Bundler with a non-Bundler-compatible forced module is
|
|
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
|
+
*
|
|
75
|
+
* - Anything else (Node10 / Classic / unset) passes through or falls back
|
|
76
|
+
* to Node10. These pairings are valid with every forced module kind.
|
|
77
|
+
*
|
|
78
|
+
* Compatibility: `ModuleResolutionKind.Bundler` was introduced in
|
|
79
|
+
* TypeScript 5.0. ts-jest declares `peerDependencies: { typescript: ">=4.3 <7" }`,
|
|
80
|
+
* so the Bundler member is `undefined` at runtime on TypeScript 4.3 - 4.9.
|
|
81
|
+
* The Node16/NodeNext substitution falls back to Node10 in that case
|
|
82
|
+
* (`bundlerResolution` below) to keep the function deterministic across the
|
|
83
|
+
* full supported range. Users on TypeScript < 5 can never have set Bundler in
|
|
84
|
+
* tsconfig (the parser rejects it), so the user-supplied-Bundler branch is
|
|
85
|
+
* unreachable there and needs no separate guard.
|
|
86
|
+
*/
|
|
87
|
+
private resolveCompatibleModuleResolution;
|
|
88
|
+
/**
|
|
89
|
+
* TypeScript pairs `moduleResolution: bundler` only with ES-module module
|
|
90
|
+
* kinds (`ES2015` / `ES2020` / `ES2022` / `ESNext`) or `Preserve` (added in
|
|
91
|
+
* TypeScript 5.4). Pairing `bundler` with `CommonJS`, `AMD`, `UMD`, `System`,
|
|
92
|
+
* or `None` raises TS5095. Used by `resolveCompatibleModuleResolution` to
|
|
93
|
+
* gate the `Node16` / `NodeNext` → `Bundler` substitution and the
|
|
94
|
+
* user-supplied-`Bundler` pass-through, so neither path emits an invalid
|
|
95
|
+
* pair when the user has selected a non-ES `module`.
|
|
96
|
+
*
|
|
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`).
|
|
103
|
+
*
|
|
104
|
+
* @see https://www.typescriptlang.org/tsconfig/#moduleResolution
|
|
105
|
+
*/
|
|
106
|
+
private isBundlerCompatibleModuleKind;
|
|
107
|
+
/**
|
|
108
|
+
* Pass `customConditions` through unchanged when the resolved
|
|
109
|
+
* `moduleResolution` is one of the kinds that supports it (`Bundler`,
|
|
110
|
+
* `Node16`, `NodeNext`); strip it otherwise. TypeScript raises TS5098
|
|
111
|
+
* when `customConditions` is paired with any other resolution kind
|
|
112
|
+
* (verified empirically against TypeScript 5.9.3 with `tsc -p`).
|
|
113
|
+
*
|
|
114
|
+
* Before #4198 the surrounding `fixupCompilerOptionsForModuleKind`
|
|
115
|
+
* unconditionally cleared `customConditions` because the hardcoded
|
|
116
|
+
* `Node10` override always made it incompatible. After #4198 the
|
|
117
|
+
* resolved `moduleResolution` can be `Bundler` (e.g. when the user
|
|
118
|
+
* has `Node16`/`NodeNext` paired with an ES-family `module`), so we
|
|
119
|
+
* need to preserve the user's `customConditions` in that case rather
|
|
120
|
+
* than silently dropping it.
|
|
121
|
+
*
|
|
122
|
+
* @see https://www.typescriptlang.org/tsconfig/#customConditions
|
|
123
|
+
*/
|
|
124
|
+
private preserveCustomConditionsIfCompatible;
|
|
24
125
|
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
|
|
25
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;
|
|
26
134
|
protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
|
|
27
135
|
}
|
|
@@ -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 {
|
|
@@ -49,6 +49,10 @@ class TsCompiler {
|
|
|
49
49
|
* @internal
|
|
50
50
|
*/
|
|
51
51
|
_projectVersion = 1;
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
_previousCompiledModuleKind;
|
|
52
56
|
/**
|
|
53
57
|
* @internal
|
|
54
58
|
*/
|
|
@@ -107,17 +111,38 @@ class TsCompiler {
|
|
|
107
111
|
});
|
|
108
112
|
return importedModulePaths;
|
|
109
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Apply ts-jest's runtime fixups on top of the user's compiler options before
|
|
116
|
+
* handing them to the language service or transpiler.
|
|
117
|
+
*
|
|
118
|
+
* Two compiler-options now flow through dedicated helpers so the produced
|
|
119
|
+
* options are always a TypeScript-valid combination:
|
|
120
|
+
*
|
|
121
|
+
* - `moduleResolution` is delegated to `resolveCompatibleModuleResolution`,
|
|
122
|
+
* which preserves the user's value when it is valid alongside the
|
|
123
|
+
* `module` ts-jest forces at runtime (CommonJS on the CJS path, or
|
|
124
|
+
* ESNext / the user's original `module` on the ESM path) and otherwise
|
|
125
|
+
* substitutes a TypeScript-valid alternative. When the user has not set
|
|
126
|
+
* a value the historical Node10 default is kept, so unchanged tsconfigs
|
|
127
|
+
* see the exact same resolved options as before.
|
|
128
|
+
*
|
|
129
|
+
* - `customConditions` is delegated to `preserveCustomConditionsIfCompatible`,
|
|
130
|
+
* which keeps the user's value only when the resolved
|
|
131
|
+
* `moduleResolution` supports it (`Bundler` / `Node16` / `NodeNext`)
|
|
132
|
+
* and clears it otherwise. The pre-#4198 code unconditionally cleared
|
|
133
|
+
* this option because the hardcoded `Node10` override always made it
|
|
134
|
+
* incompatible; that is no longer true.
|
|
135
|
+
*
|
|
136
|
+
* @see https://github.com/kulshekhar/ts-jest/issues/4198
|
|
137
|
+
*/
|
|
110
138
|
fixupCompilerOptionsForModuleKind(compilerOptions, isEsm) {
|
|
111
|
-
const moduleResolution = this._ts.ModuleResolutionKind.Node10 ?? this._ts.ModuleResolutionKind.NodeJs;
|
|
112
139
|
if (!isEsm) {
|
|
140
|
+
const moduleResolution = this.resolveCompatibleModuleResolution(this._ts.ModuleKind.CommonJS, compilerOptions.moduleResolution);
|
|
113
141
|
return {
|
|
114
142
|
...compilerOptions,
|
|
115
143
|
module: this._ts.ModuleKind.CommonJS,
|
|
116
144
|
moduleResolution,
|
|
117
|
-
|
|
118
|
-
* This option is only supported in `Node16`/`NodeNext` and `Bundler` module, see https://www.typescriptlang.org/tsconfig/#customConditions
|
|
119
|
-
*/
|
|
120
|
-
customConditions: undefined,
|
|
145
|
+
customConditions: this.preserveCustomConditionsIfCompatible(moduleResolution, compilerOptions.customConditions),
|
|
121
146
|
};
|
|
122
147
|
}
|
|
123
148
|
let moduleKind = compilerOptions.module ?? this._ts.ModuleKind.ESNext;
|
|
@@ -126,32 +151,148 @@ class TsCompiler {
|
|
|
126
151
|
esModuleInterop = true;
|
|
127
152
|
moduleKind = this._ts.ModuleKind.ESNext;
|
|
128
153
|
}
|
|
154
|
+
const moduleResolution = this.resolveCompatibleModuleResolution(moduleKind, compilerOptions.moduleResolution);
|
|
129
155
|
return {
|
|
130
156
|
...compilerOptions,
|
|
131
157
|
module: moduleKind,
|
|
132
158
|
esModuleInterop,
|
|
133
159
|
moduleResolution,
|
|
134
|
-
|
|
135
|
-
* This option is only supported in `Node16`/`NodeNext` and `Bundler` module, see https://www.typescriptlang.org/tsconfig/#customConditions
|
|
136
|
-
*/
|
|
137
|
-
customConditions: undefined,
|
|
160
|
+
customConditions: this.preserveCustomConditionsIfCompatible(moduleResolution, compilerOptions.customConditions),
|
|
138
161
|
};
|
|
139
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Pick a `moduleResolution` value that is valid alongside the `module` ts-jest
|
|
165
|
+
* forces at runtime. Closes #4198: previously this was hardcoded to Node10 and
|
|
166
|
+
* silently overrode whatever the user set in tsconfig, even when the user value
|
|
167
|
+
* would have been valid (e.g. Bundler with module: ESNext, Classic with CommonJS).
|
|
168
|
+
*
|
|
169
|
+
* Substitution rules — each tied to a specific TypeScript diagnostic that the
|
|
170
|
+
* resulting combination would otherwise raise. The "Bundler-compatible" set is
|
|
171
|
+
* the one defined by `isBundlerCompatibleModuleKind` (ES2015 / ES2020 / ES2022
|
|
172
|
+
* / ESNext / Preserve); everything else (CommonJS / AMD / UMD / System / None)
|
|
173
|
+
* is treated as Bundler-incompatible across the full supported TS range.
|
|
174
|
+
*
|
|
175
|
+
* - Node16 / NodeNext require `module: Node16` or `module: NodeNext` (TS5110).
|
|
176
|
+
* ts-jest never emits those module kinds, so these user-supplied values are
|
|
177
|
+
* substituted: to Bundler when the forced module is in the
|
|
178
|
+
* Bundler-compatible set, or to Node10 otherwise. (Pairing Bundler with a
|
|
179
|
+
* non-ES module raises TS5095, and Node10 is the only kind that has been
|
|
180
|
+
* valid with non-ES modules across every TypeScript version ts-jest
|
|
181
|
+
* supports.)
|
|
182
|
+
*
|
|
183
|
+
* - User-supplied Bundler with a non-Bundler-compatible forced module is
|
|
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
|
+
*
|
|
190
|
+
* - Anything else (Node10 / Classic / unset) passes through or falls back
|
|
191
|
+
* to Node10. These pairings are valid with every forced module kind.
|
|
192
|
+
*
|
|
193
|
+
* Compatibility: `ModuleResolutionKind.Bundler` was introduced in
|
|
194
|
+
* TypeScript 5.0. ts-jest declares `peerDependencies: { typescript: ">=4.3 <7" }`,
|
|
195
|
+
* so the Bundler member is `undefined` at runtime on TypeScript 4.3 - 4.9.
|
|
196
|
+
* The Node16/NodeNext substitution falls back to Node10 in that case
|
|
197
|
+
* (`bundlerResolution` below) to keep the function deterministic across the
|
|
198
|
+
* full supported range. Users on TypeScript < 5 can never have set Bundler in
|
|
199
|
+
* tsconfig (the parser rejects it), so the user-supplied-Bundler branch is
|
|
200
|
+
* unreachable there and needs no separate guard.
|
|
201
|
+
*/
|
|
202
|
+
resolveCompatibleModuleResolution(forcedModule, userResolution) {
|
|
203
|
+
const node10Default = this._ts.ModuleResolutionKind.Node10 ?? this._ts.ModuleResolutionKind.NodeJs;
|
|
204
|
+
if (userResolution === undefined) {
|
|
205
|
+
return node10Default;
|
|
206
|
+
}
|
|
207
|
+
const { Node16, NodeNext, Bundler } = this._ts.ModuleResolutionKind;
|
|
208
|
+
const bundlerResolution = Bundler ?? node10Default;
|
|
209
|
+
const canUseBundler = this.isBundlerCompatibleModuleKind(forcedModule);
|
|
210
|
+
if (userResolution === Node16 || userResolution === NodeNext) {
|
|
211
|
+
return canUseBundler ? bundlerResolution : node10Default;
|
|
212
|
+
}
|
|
213
|
+
if (userResolution === Bundler && !canUseBundler) {
|
|
214
|
+
return node10Default;
|
|
215
|
+
}
|
|
216
|
+
return userResolution;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* TypeScript pairs `moduleResolution: bundler` only with ES-module module
|
|
220
|
+
* kinds (`ES2015` / `ES2020` / `ES2022` / `ESNext`) or `Preserve` (added in
|
|
221
|
+
* TypeScript 5.4). Pairing `bundler` with `CommonJS`, `AMD`, `UMD`, `System`,
|
|
222
|
+
* or `None` raises TS5095. Used by `resolveCompatibleModuleResolution` to
|
|
223
|
+
* gate the `Node16` / `NodeNext` → `Bundler` substitution and the
|
|
224
|
+
* user-supplied-`Bundler` pass-through, so neither path emits an invalid
|
|
225
|
+
* pair when the user has selected a non-ES `module`.
|
|
226
|
+
*
|
|
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`).
|
|
233
|
+
*
|
|
234
|
+
* @see https://www.typescriptlang.org/tsconfig/#moduleResolution
|
|
235
|
+
*/
|
|
236
|
+
isBundlerCompatibleModuleKind(moduleKind) {
|
|
237
|
+
const M = this._ts.ModuleKind;
|
|
238
|
+
if (moduleKind === M.ESNext || moduleKind === M.ES2015 || moduleKind === M.ES2020 || moduleKind === M.ES2022) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
// `ModuleKind.Preserve` was introduced in TypeScript 5.4; on older
|
|
242
|
+
// TypeScript versions the property is `undefined` at runtime.
|
|
243
|
+
if (M.Preserve !== undefined && moduleKind === M.Preserve) {
|
|
244
|
+
return true;
|
|
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
|
+
}
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Pass `customConditions` through unchanged when the resolved
|
|
255
|
+
* `moduleResolution` is one of the kinds that supports it (`Bundler`,
|
|
256
|
+
* `Node16`, `NodeNext`); strip it otherwise. TypeScript raises TS5098
|
|
257
|
+
* when `customConditions` is paired with any other resolution kind
|
|
258
|
+
* (verified empirically against TypeScript 5.9.3 with `tsc -p`).
|
|
259
|
+
*
|
|
260
|
+
* Before #4198 the surrounding `fixupCompilerOptionsForModuleKind`
|
|
261
|
+
* unconditionally cleared `customConditions` because the hardcoded
|
|
262
|
+
* `Node10` override always made it incompatible. After #4198 the
|
|
263
|
+
* resolved `moduleResolution` can be `Bundler` (e.g. when the user
|
|
264
|
+
* has `Node16`/`NodeNext` paired with an ES-family `module`), so we
|
|
265
|
+
* need to preserve the user's `customConditions` in that case rather
|
|
266
|
+
* than silently dropping it.
|
|
267
|
+
*
|
|
268
|
+
* @see https://www.typescriptlang.org/tsconfig/#customConditions
|
|
269
|
+
*/
|
|
270
|
+
preserveCustomConditionsIfCompatible(resolvedModuleResolution, userCustomConditions) {
|
|
271
|
+
const R = this._ts.ModuleResolutionKind;
|
|
272
|
+
const supportsCustomConditions = resolvedModuleResolution === R.Bundler ||
|
|
273
|
+
resolvedModuleResolution === R.Node16 ||
|
|
274
|
+
resolvedModuleResolution === R.NodeNext;
|
|
275
|
+
return supportsCustomConditions ? userCustomConditions : undefined;
|
|
276
|
+
}
|
|
140
277
|
getCompiledOutput(fileContent, fileName, options) {
|
|
141
278
|
const isEsmMode = this.configSet.useESM && options.supportsStaticESM;
|
|
142
279
|
this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode);
|
|
143
280
|
const moduleKind = this._initialCompilerOptions.module;
|
|
144
281
|
const currentModuleKind = this._compilerOptions.module;
|
|
282
|
+
// Without this, a Program rebuilt for one compile's module kind would be
|
|
283
|
+
// reused on the next compile when that compile expects a different kind.
|
|
284
|
+
const moduleKindChangedSinceLastCompile = this._previousCompiledModuleKind !== undefined && this._previousCompiledModuleKind !== currentModuleKind;
|
|
285
|
+
this._previousCompiledModuleKind = currentModuleKind;
|
|
145
286
|
if (this._languageService) {
|
|
146
287
|
if (constants_1.JS_JSX_REGEX.test(fileName) && !this._compilerOptions.allowJs) {
|
|
147
|
-
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 }));
|
|
148
289
|
return {
|
|
149
290
|
code: fileContent,
|
|
150
291
|
};
|
|
151
292
|
}
|
|
152
293
|
this._logger.debug({ fileName }, 'getCompiledOutput(): compiling using language service');
|
|
153
294
|
// Must set memory cache before attempting to compile
|
|
154
|
-
this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
|
|
295
|
+
this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind && !moduleKindChangedSinceLastCompile);
|
|
155
296
|
const output = this._languageService.getEmitOutput(fileName);
|
|
156
297
|
const diagnostics = this.getDiagnostics(fileName);
|
|
157
298
|
if ((0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
|
@@ -190,10 +331,10 @@ class TsCompiler {
|
|
|
190
331
|
}
|
|
191
332
|
if (output.emitSkipped) {
|
|
192
333
|
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
|
193
|
-
throw new Error((0, messages_1.interpolate)(
|
|
334
|
+
throw new Error((0, messages_1.interpolate)(messages_1.Errors.CannotProcessFile, { file: fileName }));
|
|
194
335
|
}
|
|
195
336
|
else {
|
|
196
|
-
this._logger.warn((0, messages_1.interpolate)(
|
|
337
|
+
this._logger.warn((0, messages_1.interpolate)(messages_1.Errors.CannotProcessFileReturnOriginal, { file: fileName }));
|
|
197
338
|
return {
|
|
198
339
|
code: fileContent,
|
|
199
340
|
};
|
|
@@ -201,7 +342,7 @@ class TsCompiler {
|
|
|
201
342
|
}
|
|
202
343
|
// Throw an error when requiring `.d.ts` files.
|
|
203
344
|
if (!output.outputFiles.length) {
|
|
204
|
-
throw new TypeError((0, messages_1.interpolate)(
|
|
345
|
+
throw new TypeError((0, messages_1.interpolate)(messages_1.Errors.UnableToRequireDefinitionFile, {
|
|
205
346
|
file: (0, path_1.basename)(fileName),
|
|
206
347
|
}));
|
|
207
348
|
}
|
|
@@ -235,12 +376,14 @@ class TsCompiler {
|
|
|
235
376
|
* This code path should be removed in the next major version to benefit from checking on compiler options
|
|
236
377
|
*/
|
|
237
378
|
if (!(0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
|
238
|
-
|
|
379
|
+
const result = this._ts.transpileModule(fileContent, {
|
|
239
380
|
fileName,
|
|
240
381
|
transformers: this._makeTransformers(this.configSet.resolvedTransformers),
|
|
241
382
|
compilerOptions: this._compilerOptions,
|
|
242
383
|
reportDiagnostics: this.configSet.shouldReportDiagnostics(fileName),
|
|
243
384
|
});
|
|
385
|
+
const diagnostics = this._filterDiagnosticsFromTsJestDefaults(result.diagnostics);
|
|
386
|
+
return diagnostics === result.diagnostics ? result : { ...result, diagnostics };
|
|
244
387
|
}
|
|
245
388
|
return (0, transpile_module_1.tsTranspileModule)(fileContent, {
|
|
246
389
|
fileName,
|
|
@@ -252,6 +395,24 @@ class TsCompiler {
|
|
|
252
395
|
reportDiagnostics: fileName ? this.configSet.shouldReportDiagnostics(fileName) : false,
|
|
253
396
|
});
|
|
254
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
|
+
}
|
|
255
416
|
_makeTransformers(customTransformers) {
|
|
256
417
|
return {
|
|
257
418
|
before: customTransformers.before.map((beforeTransformer) => beforeTransformer.factory(this, beforeTransformer.options)),
|
|
@@ -322,7 +483,13 @@ class TsCompiler {
|
|
|
322
483
|
getCompilationSettings: () => this._compilerOptions,
|
|
323
484
|
getDefaultLibFileName: () => this._ts.getDefaultLibFilePath(this._compilerOptions),
|
|
324
485
|
getCustomTransformers: () => this._makeTransformers(this.configSet.resolvedTransformers),
|
|
325
|
-
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
|
+
},
|
|
326
493
|
};
|
|
327
494
|
this._logger.debug('created language service');
|
|
328
495
|
this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry(this._ts.sys.useCaseSensitiveFileNames, this.configSet.cwd));
|
|
@@ -345,10 +512,14 @@ class TsCompiler {
|
|
|
345
512
|
* @internal
|
|
346
513
|
*/
|
|
347
514
|
_getImportedModulePaths(resolvedFileContent, containingFile) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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);
|
|
352
523
|
/* istanbul ignore next already covered */
|
|
353
524
|
const resolvedFileName = resolvedModule?.resolvedFileName;
|
|
354
525
|
/* istanbul ignore next already covered */
|
|
@@ -359,12 +530,30 @@ class TsCompiler {
|
|
|
359
530
|
/**
|
|
360
531
|
* @internal
|
|
361
532
|
*/
|
|
362
|
-
|
|
533
|
+
_getResolutionMode(containingFile) {
|
|
534
|
+
const getImpliedNodeFormat = this._ts.getImpliedNodeFormatForFile;
|
|
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) {
|
|
363
552
|
return this._ts.resolveModuleName(moduleNameToResolve, containingFile, this._compilerOptions,
|
|
364
553
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
365
554
|
this._moduleResolutionHost,
|
|
366
555
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
367
|
-
this._moduleResolutionCache);
|
|
556
|
+
this._moduleResolutionCache, undefined, resolutionMode);
|
|
368
557
|
}
|
|
369
558
|
/**
|
|
370
559
|
* @internal
|
|
@@ -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'] ?? {};
|
|
@@ -189,11 +189,14 @@ class TsJestTransformer {
|
|
|
189
189
|
const transpiledResult = typescript_1.default.transpileModule(sourceText, {
|
|
190
190
|
compilerOptions: {
|
|
191
191
|
...configs.parsedTsConfig.options,
|
|
192
|
-
module: transformOptions.supportsStaticESM && transformOptions.transformerConfig
|
|
192
|
+
module: transformOptions.supportsStaticESM && transformOptions.transformerConfig?.useESM
|
|
193
193
|
? typescript_1.default.ModuleKind.ESNext
|
|
194
194
|
: typescript_1.default.ModuleKind.CommonJS,
|
|
195
195
|
},
|
|
196
|
-
fileName:
|
|
196
|
+
// .mjs fileName causes ts.transpileModule to preserve ESM syntax even with module: CommonJS
|
|
197
|
+
fileName: transformOptions.supportsStaticESM && transformOptions.transformerConfig?.useESM
|
|
198
|
+
? sourcePath
|
|
199
|
+
: sourcePath.replace(/\.mjs$/, '.js'),
|
|
197
200
|
});
|
|
198
201
|
result = {
|
|
199
202
|
code: (0, compiler_utils_1.updateOutput)(transpiledResult.outputText, sourcePath, transpiledResult.sourceMapText),
|
|
@@ -212,7 +215,7 @@ class TsJestTransformer {
|
|
|
212
215
|
// we should not get called for files with other extension than js[x], ts[x] and d.ts,
|
|
213
216
|
// TypeScript will bail if we try to compile, and if it was to call babel, users can
|
|
214
217
|
// define the transform value with `babel-jest` for this extension instead
|
|
215
|
-
const message = babelJest ?
|
|
218
|
+
const message = babelJest ? messages_1.Errors.GotUnknownFileTypeWithBabel : messages_1.Errors.GotUnknownFileTypeWithoutBabel;
|
|
216
219
|
this._logger.warn({ fileName: sourcePath }, (0, messages_1.interpolate)(message, { path: sourcePath }));
|
|
217
220
|
result = {
|
|
218
221
|
code: sourceText,
|
|
@@ -62,10 +62,17 @@ function factory({ configSet }) {
|
|
|
62
62
|
if (statements.length <= 1) {
|
|
63
63
|
return statements;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// Return 0 for same-category statements so stable sort preserves source
|
|
66
|
+
// order, the previous `-1 | 1`-only comparator violated ECMA's consistent
|
|
67
|
+
// comparison contract and let V8 reorder same-category pairs.
|
|
68
|
+
const priority = (stmt) => {
|
|
69
|
+
if (isJestGlobalImport(stmt))
|
|
70
|
+
return 0;
|
|
71
|
+
if (isHoistableStatement(stmt))
|
|
72
|
+
return 1;
|
|
73
|
+
return 2;
|
|
74
|
+
};
|
|
75
|
+
return statements.sort((a, b) => priority(a) - priority(b));
|
|
69
76
|
};
|
|
70
77
|
const createVisitor = (ctx, _) => {
|
|
71
78
|
const visitor = (node) => {
|
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
|
@@ -27,7 +27,17 @@ class Importer {
|
|
|
27
27
|
return this._import(why, '@babel/core');
|
|
28
28
|
}
|
|
29
29
|
typescript(why, which) {
|
|
30
|
-
|
|
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)(messages_1.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');
|
|
@@ -81,10 +91,10 @@ class Importer {
|
|
|
81
91
|
if (!res.error)
|
|
82
92
|
return res.exports;
|
|
83
93
|
// it could not load because of a failure while importing, but it exists
|
|
84
|
-
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 }));
|
|
85
95
|
}
|
|
86
96
|
// if it couldn't load, build a nice error message so the user can fix it by himself
|
|
87
|
-
const msg = alternatives.length ?
|
|
97
|
+
const msg = alternatives.length ? messages_1.Errors.UnableToLoadAnyModule : messages_1.Errors.UnableToLoadOneModule;
|
|
88
98
|
const loadModule = [moduleName, ...alternatives].map((m) => `"${m}"`).join(', ');
|
|
89
99
|
if (typeof installTip === 'string') {
|
|
90
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
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.14
|
|
4
|
+
npm error 404
|
|
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
|
+
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-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 .",
|
|
@@ -61,12 +60,12 @@
|
|
|
61
60
|
"json5": "^2.2.3",
|
|
62
61
|
"lodash.memoize": "^4.1.2",
|
|
63
62
|
"make-error": "^1.3.6",
|
|
64
|
-
"semver": "^7.
|
|
65
|
-
"type-fest": "^5.
|
|
63
|
+
"semver": "^7.8.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.
|
|
102
|
-
"@eslint/js": "^9.39.
|
|
103
|
-
"@jest/globals": "^30.
|
|
104
|
-
"@jest/transform": "^30.
|
|
105
|
-
"@jest/types": "^30.
|
|
100
|
+
"@eslint/eslintrc": "^3.3.7",
|
|
101
|
+
"@eslint/js": "^9.39.5",
|
|
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",
|
|
@@ -111,17 +110,15 @@
|
|
|
111
110
|
"@types/lodash.memoize": "^4.1.9",
|
|
112
111
|
"@types/lodash.set": "^4.3.9",
|
|
113
112
|
"@types/micromatch": "^4.0.10",
|
|
114
|
-
"@types/node": "20.19.
|
|
115
|
-
"@types/semver": "^7.
|
|
113
|
+
"@types/node": "20.19.43",
|
|
114
|
+
"@types/semver": "^7.8.0",
|
|
116
115
|
"@types/yargs": "^17.0.35",
|
|
117
116
|
"@types/yargs-parser": "21.0.3",
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"esbuild": "~0.27.4",
|
|
124
|
-
"eslint": "^9.39.4",
|
|
117
|
+
"babel-jest": "^30.5.2",
|
|
118
|
+
"conventional-changelog-angular": "^8.3.1",
|
|
119
|
+
"conventional-changelog": "^7.2.1",
|
|
120
|
+
"esbuild": "~0.28.2",
|
|
121
|
+
"eslint": "^9.39.5",
|
|
125
122
|
"eslint-config-prettier": "^10.1.8",
|
|
126
123
|
"eslint-plugin-import": "^2.32.0",
|
|
127
124
|
"eslint-plugin-jest": "^28.14.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.
|
|
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
|
}
|