ts-jest 28.0.0-next.2 → 28.0.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
|
+
8d08d902933d1a4cbd0bd1d101897a0e0238883e
|
package/CHANGELOG.md
CHANGED
|
@@ -1,47 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
## [28.0.1](https://github.com/kulshekhar/ts-jest/compare/v28.0.0...v28.0.1) (2022-05-03)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* lower the required node version to ^16.10 ([#3495](https://github.com/kulshekhar/ts-jest/issues/3495)) ([3a4e48a](https://github.com/kulshekhar/ts-jest/commit/3a4e48afffa56f76efb98f48ad3e07a92731748e)), closes [#3494](https://github.com/kulshekhar/ts-jest/issues/3494)
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
### Features
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
# [28.0.0](https://github.com/kulshekhar/ts-jest/compare/v28.0.0-next.3...v28.0.0) (2022-05-02)
|
|
12
11
|
|
|
13
12
|
|
|
13
|
+
### Bug Fixes
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
* **legacy** invoke Babel `processAsync` for `babel-jest` in ESM mode instead of `process` ([#3430](https://github.com/kulshekhar/ts-jest/issues/3430)) ([0d7356c](https://github.com/kulshekhar/ts-jest/commit/0d7356cd767a924e5b57e3a93679eef4ca8fae51))
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
### Features
|
|
19
19
|
|
|
20
|
+
* **presets:** add presets for legacy mode ([#3465](https://github.com/kulshekhar/ts-jest/issues/3465)) ([543b4ad](https://github.com/kulshekhar/ts-jest/commit/543b4ad729d20fbd46a2de5cd4660dc50b94ebe7))
|
|
20
21
|
* mark `ConfigSet` as legacy ([#3456](https://github.com/kulshekhar/ts-jest/issues/3456)) ([a986729](https://github.com/kulshekhar/ts-jest/commit/a98672977a679d1ed882605a3e71ed405432ffdc))
|
|
21
22
|
* mark `TsCompiler` and `TsJestCompiler` as legacy ([#3457](https://github.com/kulshekhar/ts-jest/issues/3457)) ([0f2fe30](https://github.com/kulshekhar/ts-jest/commit/0f2fe306762d8549bd29737becd4aed14a650427))
|
|
22
23
|
* remove `path-mapping` AST transformer ([#3455](https://github.com/kulshekhar/ts-jest/issues/3455)) ([f566869](https://github.com/kulshekhar/ts-jest/commit/f5668698f8fab78b3008d936aa5001f134f530e2))
|
|
23
24
|
* set Jest peer dependencies to v28 ([#3454](https://github.com/kulshekhar/ts-jest/issues/3454)) ([1e880ff](https://github.com/kulshekhar/ts-jest/commit/1e880fffe82bca231d1d23f6508f4ab4bc31e03e))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### BREAKING CHANGES
|
|
27
|
-
|
|
28
|
-
* `path-mapping` AST transformer is no longer shipped in `ts-jest` v28. Please use an alternative one like https://github.com/LeDDGroup/typescript-transform-paths instead.
|
|
29
|
-
* Any imports `ts-jest/dist/compiler/ts-compiler` should change to `ts-jest/dist/legacy/compiler/ts-compiler`
|
|
30
|
-
* Any imports `ts-jest/dist/compiler/ts-jest-compiler` should change to `ts-jest/dist/legacy/compiler/ts-jest-compiler`
|
|
31
|
-
* Any imports `ts-jest/dist/config/config-set` should change to `ts-jest/dist/legacy/config/config-set
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# [28.0.0-next.0](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v28.0.0-next.0) (2022-04-24)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### Bug Fixes
|
|
39
|
-
|
|
40
|
-
* **legacy** invoke Babel `processAsync` for `babel-jest` in ESM mode instead of `process` ([#3430](https://github.com/kulshekhar/ts-jest/issues/3430)) ([0d7356c](https://github.com/kulshekhar/ts-jest/commit/0d7356cd767a924e5b57e3a93679eef4ca8fae51))
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Features
|
|
44
|
-
|
|
45
25
|
* **core:** drop support for Node.js 10 ([#3332](https://github.com/kulshekhar/ts-jest/issues/3332)) ([7a9aa61](https://github.com/kulshekhar/ts-jest/commit/7a9aa615ea0be881105676a17d5bd655afdc27f5))
|
|
46
26
|
* **core:** remove `mocked` testing util ([#3333](https://github.com/kulshekhar/ts-jest/issues/3333)) ([2d9017d](https://github.com/kulshekhar/ts-jest/commit/2d9017ddfea39f45aa991876b314d1dbe4a36aad))
|
|
47
27
|
* **core:** remove `ts-jest/utils` sub path export ([#3334](https://github.com/kulshekhar/ts-jest/issues/3334)) ([9f253d3](https://github.com/kulshekhar/ts-jest/commit/9f253d31dfcefa35ae00049d0d2dc4a3fe1b2f34))
|
|
@@ -50,23 +30,15 @@
|
|
|
50
30
|
|
|
51
31
|
### BREAKING CHANGES
|
|
52
32
|
|
|
53
|
-
*
|
|
54
|
-
*
|
|
33
|
+
* `path-mapping` AST transformer is no longer shipped in `ts-jest` v28. Please use an alternative one like https://github.com/LeDDGroup/typescript-transform-paths instead.
|
|
34
|
+
* Any imports `ts-jest/dist/compiler/ts-compiler` should change to `ts-jest/dist/legacy/compiler/ts-compiler`
|
|
35
|
+
* Any imports `ts-jest/dist/compiler/ts-jest-compiler` should change to `ts-jest/dist/legacy/compiler/ts-jest-compiler`
|
|
36
|
+
* Any imports `ts-jest/dist/config/config-set` should change to `ts-jest/dist/legacy/config/config-set`
|
|
37
|
+
* Minimum support `TypeScript` version is now **4.3** since Jest 28 requires it.
|
|
38
|
+
* **Jest 28** is required.
|
|
55
39
|
* **core:** Any imports `ts-jest/utils` should be replaced with `ts-jest`.
|
|
56
40
|
* **core:** Starting from Jest 27.4, `mocked` has been integrated into Jest repo.
|
|
57
|
-
* **core:** Support for Node.js v10 has been removed as Jest drops support for it
|
|
58
|
-
* All presets now will they are preserved for refactored codes. If you wish to use the old codes, please do the following
|
|
59
|
-
*
|
|
60
|
-
```diff
|
|
61
|
-
// jest.config.js
|
|
62
|
-
module.exports = {
|
|
63
|
-
// [...]
|
|
64
|
-
- preset: 'ts-jest', // or 'js-with-babel'/'js-with-ts'
|
|
65
|
-
+ transform: {
|
|
66
|
-
'^.+\\.tsx?$': 'ts-jest/legacy' // or '^.+\\.[tj]sx?$': 'ts-jest' to use legacy codes
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
41
|
+
* **core:** Support for Node.js v10 has been removed as Jest drops support for it.
|
|
70
42
|
|
|
71
43
|
|
|
72
44
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateOutput = exports.SOURCE_MAPPING_PREFIX = void 0;
|
|
4
|
+
var utils_1 = require("../../utils");
|
|
5
|
+
exports.SOURCE_MAPPING_PREFIX = 'sourceMappingURL=';
|
|
6
|
+
function updateOutput(outputText, normalizedFileName, sourceMap) {
|
|
7
|
+
if (sourceMap) {
|
|
8
|
+
var base64Map = Buffer.from(updateSourceMap(sourceMap, normalizedFileName), 'utf8').toString('base64');
|
|
9
|
+
var sourceMapContent = "data:application/json;charset=utf-8;base64,".concat(base64Map);
|
|
10
|
+
return (outputText.slice(0, outputText.lastIndexOf(exports.SOURCE_MAPPING_PREFIX) + exports.SOURCE_MAPPING_PREFIX.length) +
|
|
11
|
+
sourceMapContent);
|
|
12
|
+
}
|
|
13
|
+
return outputText;
|
|
14
|
+
}
|
|
15
|
+
exports.updateOutput = updateOutput;
|
|
16
|
+
var updateSourceMap = function (sourceMapText, normalizedFileName) {
|
|
17
|
+
var sourceMap = JSON.parse(sourceMapText);
|
|
18
|
+
sourceMap.file = normalizedFileName;
|
|
19
|
+
sourceMap.sources = [normalizedFileName];
|
|
20
|
+
delete sourceMap.sourceRoot;
|
|
21
|
+
return (0, utils_1.stringify)(sourceMap);
|
|
22
|
+
};
|
|
@@ -57,6 +57,7 @@ var lodash_memoize_1 = __importDefault(require("lodash.memoize"));
|
|
|
57
57
|
var constants_1 = require("../../constants");
|
|
58
58
|
var utils_1 = require("../../utils");
|
|
59
59
|
var messages_1 = require("../../utils/messages");
|
|
60
|
+
var compiler_utils_1 = require("./compiler-utils");
|
|
60
61
|
var TsCompiler = (function () {
|
|
61
62
|
function TsCompiler(configSet, runtimeCacheFS) {
|
|
62
63
|
var _a;
|
|
@@ -146,13 +147,13 @@ var TsCompiler = (function () {
|
|
|
146
147
|
file: (0, path_1.basename)(fileName),
|
|
147
148
|
}));
|
|
148
149
|
}
|
|
150
|
+
var outputFiles = output.outputFiles;
|
|
149
151
|
return this._compilerOptions.sourceMap
|
|
150
152
|
? {
|
|
151
|
-
code:
|
|
152
|
-
map: output.outputFiles[0].text,
|
|
153
|
+
code: (0, compiler_utils_1.updateOutput)(outputFiles[1].text, fileName, outputFiles[0].text),
|
|
153
154
|
}
|
|
154
155
|
: {
|
|
155
|
-
code:
|
|
156
|
+
code: (0, compiler_utils_1.updateOutput)(outputFiles[0].text, fileName),
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
159
|
else {
|
|
@@ -162,8 +163,7 @@ var TsCompiler = (function () {
|
|
|
162
163
|
this.configSet.raiseDiagnostics(result.diagnostics, fileName, this._logger);
|
|
163
164
|
}
|
|
164
165
|
return {
|
|
165
|
-
code: result.outputText,
|
|
166
|
-
map: result.sourceMapText,
|
|
166
|
+
code: (0, compiler_utils_1.updateOutput)(result.outputText, fileName, result.sourceMapText),
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
};
|
|
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
13
36
|
var __values = (this && this.__values) || function(o) {
|
|
14
37
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
38
|
if (m) return m.call(o);
|
|
@@ -58,6 +81,7 @@ var bs_logger_1 = require("bs-logger");
|
|
|
58
81
|
var jest_util_1 = require("jest-util");
|
|
59
82
|
var json5_1 = __importDefault(require("json5"));
|
|
60
83
|
var constants_1 = require("../../constants");
|
|
84
|
+
var hoistJestTransformer = __importStar(require("../../transformers/hoist-jest"));
|
|
61
85
|
var utils_1 = require("../../utils");
|
|
62
86
|
var backports_1 = require("../../utils/backports");
|
|
63
87
|
var importer_1 = require("../../utils/importer");
|
|
@@ -232,7 +256,13 @@ var ConfigSet = (function () {
|
|
|
232
256
|
this.parsedTsConfig = this._getAndResolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath);
|
|
233
257
|
this.raiseDiagnostics(this.parsedTsConfig.errors, configFilePath);
|
|
234
258
|
this.logger.debug({ tsconfig: this.parsedTsConfig }, 'normalized typescript config via ts-jest option');
|
|
235
|
-
this.resolvedTransformers.before = [
|
|
259
|
+
this.resolvedTransformers.before = [
|
|
260
|
+
{
|
|
261
|
+
factory: hoistJestTransformer.factory,
|
|
262
|
+
name: hoistJestTransformer.name,
|
|
263
|
+
version: hoistJestTransformer.version,
|
|
264
|
+
},
|
|
265
|
+
];
|
|
236
266
|
var astTransformers = options.astTransformers;
|
|
237
267
|
if (astTransformers) {
|
|
238
268
|
var resolveTransformerFunc_1 = function (transformerPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "28.0.
|
|
3
|
+
"version": "28.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@types/lodash.memoize": "4.x",
|
|
103
103
|
"@types/lodash.set": "4.x",
|
|
104
104
|
"@types/micromatch": "4.x",
|
|
105
|
-
"@types/node": "17.0.
|
|
105
|
+
"@types/node": "17.0.31",
|
|
106
106
|
"@types/node-fetch": "^3.0.3",
|
|
107
107
|
"@types/react": "18.x",
|
|
108
108
|
"@types/rimraf": "^3.0.2",
|
|
@@ -144,6 +144,6 @@
|
|
|
144
144
|
]
|
|
145
145
|
},
|
|
146
146
|
"engines": {
|
|
147
|
-
"node": "^12.13.0 || ^14.15.0 || ^16.
|
|
147
|
+
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
|
|
148
148
|
}
|
|
149
149
|
}
|