ts-jest 29.2.0 → 29.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
c4213aa1dd0f0a90f21d975c76687678d1de0842
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
### [29.2.1](https://github.com/kulshekhar/ts-jest/compare/v29.2.0...v29.2.1) (2024-07-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix: move `ejs` to `dep` instead of `peerDep` ([26e31a7](https://github.com/kulshekhar/ts-jest/commit/26e31a7))
|
|
7
|
+
* fix: set `allowSyntheticDefaultImports` properly ([ff4b302](https://github.com/kulshekhar/ts-jest/commit/ff4b302)), closes [#4156](https://github.com/kulshekhar/ts-jest/issues/4156)
|
|
8
|
+
* fix(compiler): support `Node16/NodeNext` value for `target` ([2f5cc0c](https://github.com/kulshekhar/ts-jest/commit/2f5cc0c)), closes [#4198](https://github.com/kulshekhar/ts-jest/issues/4198)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## [29.2.0](https://github.com/kulshekhar/ts-jest/compare/v29.1.5...v29.2.0) (2024-07-08)
|
|
2
13
|
|
|
3
14
|
|
|
4
15
|
### Bug Fixes
|
|
@@ -9,8 +20,8 @@
|
|
|
9
20
|
### Features
|
|
10
21
|
|
|
11
22
|
* feat(cli): allow migrating cjs `presets` to `transform` config ([22fb027](https://github.com/kulshekhar/ts-jest/commit/22fb027))
|
|
12
|
-
* feat(presets): add util functions to create ESM presets ([06f78ed](https://github.com/kulshekhar/ts-jest/commit/06f78ed))
|
|
13
|
-
* feat(presets): add util functions to create CJS presets ([f9cc3c0](https://github.com/kulshekhar/ts-jest/commit/f9cc3c0))
|
|
23
|
+
* feat(presets): add util functions to create ESM presets ([06f78ed](https://github.com/kulshekhar/ts-jest/commit/06f78ed)), close [#4200](https://github.com/kulshekhar/ts-jest/issues/4200)
|
|
24
|
+
* feat(presets): add util functions to create CJS presets ([f9cc3c0](https://github.com/kulshekhar/ts-jest/commit/f9cc3c0)), close [#4200](https://github.com/kulshekhar/ts-jest/issues/4200)
|
|
14
25
|
|
|
15
26
|
|
|
16
27
|
### Code refactoring
|
|
@@ -29,7 +40,7 @@
|
|
|
29
40
|
|
|
30
41
|
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
### [29.1.5](https://github.com/kulshekhar/ts-jest/compare/v29.1.4...v29.1.5) (2024-06-16)
|
|
33
44
|
|
|
34
45
|
|
|
35
46
|
### Bug Fixes
|
|
@@ -38,7 +49,7 @@
|
|
|
38
49
|
|
|
39
50
|
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
### [29.1.4](https://github.com/kulshekhar/ts-jest/compare/v29.1.3...v29.1.4) (2024-05-28)
|
|
42
53
|
|
|
43
54
|
|
|
44
55
|
### Bug Fixes
|
|
@@ -52,7 +63,7 @@
|
|
|
52
63
|
|
|
53
64
|
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
### [29.1.3](https://github.com/kulshekhar/ts-jest/compare/v29.1.2...v29.1.3) (2024-05-21)
|
|
56
67
|
|
|
57
68
|
|
|
58
69
|
### Bug Fixes
|
|
@@ -67,7 +78,7 @@
|
|
|
67
78
|
|
|
68
79
|
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
### [29.1.2](https://github.com/kulshekhar/ts-jest/compare/v29.1.1...v29.1.2) (2024-01-22)
|
|
71
82
|
|
|
72
83
|
|
|
73
84
|
### Bug Fixes
|
|
@@ -87,7 +98,7 @@
|
|
|
87
98
|
|
|
88
99
|
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
## [29.1.0](https://github.com/kulshekhar/ts-jest/compare/v29.0.5...v29.1.0) (2023-03-26)
|
|
91
102
|
|
|
92
103
|
|
|
93
104
|
### Features
|
|
@@ -96,7 +107,7 @@
|
|
|
96
107
|
|
|
97
108
|
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
### [29.0.5](https://github.com/kulshekhar/ts-jest/compare/v29.0.4...v29.0.5) (2023-01-13)
|
|
100
111
|
|
|
101
112
|
|
|
102
113
|
### Reverts
|
|
@@ -105,7 +116,7 @@
|
|
|
105
116
|
|
|
106
117
|
|
|
107
118
|
|
|
108
|
-
|
|
119
|
+
### [29.0.4](https://github.com/kulshekhar/ts-jest/compare/v29.0.3...v29.0.4) (2023-01-10)
|
|
109
120
|
|
|
110
121
|
|
|
111
122
|
### Bug Fixes
|
|
@@ -115,7 +126,7 @@
|
|
|
115
126
|
|
|
116
127
|
|
|
117
128
|
|
|
118
|
-
|
|
129
|
+
### [29.0.3](https://github.com/kulshekhar/ts-jest/compare/v29.0.2...v29.0.3) (2022-09-28)
|
|
119
130
|
|
|
120
131
|
|
|
121
132
|
### Bug Fixes
|
|
@@ -130,7 +141,7 @@
|
|
|
130
141
|
|
|
131
142
|
|
|
132
143
|
|
|
133
|
-
|
|
144
|
+
### [29.0.2](https://github.com/kulshekhar/ts-jest/compare/v29.0.1...v29.0.2) (2022-09-23)
|
|
134
145
|
|
|
135
146
|
|
|
136
147
|
### Bug Fixes
|
|
@@ -140,16 +151,7 @@
|
|
|
140
151
|
|
|
141
152
|
|
|
142
153
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
### Bug Fixes
|
|
147
|
-
|
|
148
|
-
* mark `ts-jest` as optional in `ConfigGlobals` ([#3816](https://github.com/kulshekhar/ts-jest/issues/3816)) ([cbb88bb](https://github.com/kulshekhar/ts-jest/commit/cbb88bba34dbb852d8f4013be6e020769feb306d)), closes [#3815](https://github.com/kulshekhar/ts-jest/issues/3815)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
## [29.0.1](https://github.com/kulshekhar/ts-jest/compare/v29.0.0...v29.0.1) (2022-09-13)
|
|
154
|
+
### [29.0.1](https://github.com/kulshekhar/ts-jest/compare/v29.0.0...v29.0.1) (2022-09-13)
|
|
153
155
|
|
|
154
156
|
|
|
155
157
|
### Bug Fixes
|
|
@@ -21,6 +21,7 @@ export declare class TsCompiler implements TsCompilerInstance {
|
|
|
21
21
|
program: Program | undefined;
|
|
22
22
|
constructor(configSet: ConfigSet, runtimeCacheFS: StringMap);
|
|
23
23
|
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[];
|
|
24
|
+
private fixupCompilerOptionsForModuleKind;
|
|
24
25
|
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput;
|
|
25
26
|
protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput;
|
|
26
27
|
protected _makeTransformers(customTransformers: TsJestAstTransformer): CustomTransformers;
|
|
@@ -112,29 +112,31 @@ var TsCompiler = /** @class */ (function () {
|
|
|
112
112
|
});
|
|
113
113
|
return importedModulePaths;
|
|
114
114
|
};
|
|
115
|
+
TsCompiler.prototype.fixupCompilerOptionsForModuleKind = function (compilerOptions, isEsm) {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
if (!isEsm) {
|
|
118
|
+
var moduleKind_1 = (_a = compilerOptions.module) !== null && _a !== void 0 ? _a : this._ts.ModuleKind.CommonJS;
|
|
119
|
+
var moduleKindValue = [
|
|
120
|
+
this._ts.ModuleKind.CommonJS,
|
|
121
|
+
this._ts.ModuleKind.Node16,
|
|
122
|
+
this._ts.ModuleKind.NodeNext,
|
|
123
|
+
].includes(moduleKind_1)
|
|
124
|
+
? moduleKind_1
|
|
125
|
+
: this._ts.ModuleKind.CommonJS;
|
|
126
|
+
return __assign(__assign({}, compilerOptions), { module: moduleKindValue });
|
|
127
|
+
}
|
|
128
|
+
var moduleKind = (_b = compilerOptions.module) !== null && _b !== void 0 ? _b : this._ts.ModuleKind.ESNext;
|
|
129
|
+
var esModuleInterop = [this._ts.ModuleKind.Node16, this._ts.ModuleKind.NodeNext].includes(moduleKind)
|
|
130
|
+
? true
|
|
131
|
+
: compilerOptions.esModuleInterop;
|
|
132
|
+
return __assign(__assign({}, compilerOptions), { module: moduleKind, esModuleInterop: esModuleInterop !== null && esModuleInterop !== void 0 ? esModuleInterop : false });
|
|
133
|
+
};
|
|
115
134
|
TsCompiler.prototype.getCompiledOutput = function (fileContent, fileName, options) {
|
|
116
135
|
var e_1, _a;
|
|
117
136
|
var moduleKind = this._initialCompilerOptions.module;
|
|
118
|
-
var esModuleInterop = this._initialCompilerOptions.esModuleInterop;
|
|
119
|
-
var allowSyntheticDefaultImports = this._initialCompilerOptions.allowSyntheticDefaultImports;
|
|
120
137
|
var currentModuleKind = this._compilerOptions.module;
|
|
121
138
|
var isEsmMode = this.configSet.useESM && options.supportsStaticESM;
|
|
122
|
-
|
|
123
|
-
this.configSet.useESM) {
|
|
124
|
-
moduleKind =
|
|
125
|
-
!moduleKind ||
|
|
126
|
-
(moduleKind &&
|
|
127
|
-
![this._ts.ModuleKind.ES2015, this._ts.ModuleKind.ES2020, this._ts.ModuleKind.ESNext].includes(moduleKind))
|
|
128
|
-
? this._ts.ModuleKind.ESNext
|
|
129
|
-
: moduleKind;
|
|
130
|
-
// Make sure `esModuleInterop` and `allowSyntheticDefaultImports` true to support import CJS into ESM
|
|
131
|
-
esModuleInterop = true;
|
|
132
|
-
allowSyntheticDefaultImports = true;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
moduleKind = this._ts.ModuleKind.CommonJS;
|
|
136
|
-
}
|
|
137
|
-
this._compilerOptions = __assign(__assign({}, this._compilerOptions), { allowSyntheticDefaultImports: allowSyntheticDefaultImports, esModuleInterop: esModuleInterop, module: moduleKind });
|
|
139
|
+
this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode);
|
|
138
140
|
if (this._languageService) {
|
|
139
141
|
this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service');
|
|
140
142
|
// Must set memory cache before attempting to compile
|
|
@@ -435,11 +435,6 @@ var ConfigSet = /** @class */ (function () {
|
|
|
435
435
|
start: undefined,
|
|
436
436
|
length: undefined,
|
|
437
437
|
});
|
|
438
|
-
// at least enable synthetic default imports (except if it's set in the input config)
|
|
439
|
-
/* istanbul ignore next (already covered in unit test) */
|
|
440
|
-
if (!('allowSyntheticDefaultImports' in finalOptions)) {
|
|
441
|
-
finalOptions.allowSyntheticDefaultImports = true;
|
|
442
|
-
}
|
|
443
438
|
}
|
|
444
439
|
// Make sure when allowJs is enabled, outDir is required to have when using allowJs: true
|
|
445
440
|
if (finalOptions.allowJs && !finalOptions.outDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "29.2.
|
|
3
|
+
"version": "29.2.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"homepage": "https://kulshekhar.github.io/ts-jest",
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"bs-logger": "0.x",
|
|
55
|
+
"ejs": "^3.0.0",
|
|
55
56
|
"fast-json-stable-stringify": "2.x",
|
|
56
57
|
"jest-util": "^29.0.0",
|
|
57
58
|
"json5": "^2.2.3",
|
|
@@ -111,18 +112,17 @@
|
|
|
111
112
|
"@types/semver": "latest",
|
|
112
113
|
"@types/yargs": "latest",
|
|
113
114
|
"@types/yargs-parser": "21.0.3",
|
|
114
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
115
|
-
"@typescript-eslint/parser": "^7.
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
116
|
+
"@typescript-eslint/parser": "^7.16.0",
|
|
116
117
|
"babel-jest": "^29.7.0",
|
|
117
118
|
"conventional-changelog-cli": "^5.0.0",
|
|
118
119
|
"cross-spawn": "latest",
|
|
119
|
-
"ejs": "^3.1.10",
|
|
120
120
|
"esbuild": "~0.21.5",
|
|
121
121
|
"eslint": "^8.57.0",
|
|
122
122
|
"eslint-config-prettier": "^9.1.0",
|
|
123
123
|
"eslint-plugin-import": "^2.29.1",
|
|
124
124
|
"eslint-plugin-jest": "^28.6.0",
|
|
125
|
-
"eslint-plugin-jsdoc": "^48.
|
|
125
|
+
"eslint-plugin-jsdoc": "^48.6.0",
|
|
126
126
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
127
127
|
"eslint-plugin-prettier": "^4.2.1",
|
|
128
128
|
"execa": "5.1.1",
|