ts-jest 27.0.3 → 27.0.4
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 +17 -0
- package/dist/cli/config/init.js +1 -0
- package/dist/config/config-set.js +15 -4
- package/dist/transformers/hoist-jest.d.ts +2 -1
- package/dist/transformers/hoist-jest.js +3 -1
- package/dist/transformers/path-mapping.d.ts +2 -0
- package/dist/transformers/path-mapping.js +3 -1
- package/dist/ts-jest-transformer.js +1 -0
- package/package.json +18 -4
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
728a5836db2d1522482a6d839e7cb4bf9dc045c0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [27.0.4](https://github.com/kulshekhar/ts-jest/compare/v27.0.3...v27.0.4) (2021-07-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add `@types/jest` as optional `peerDependencies` to solve yarn 2 ([#2756](https://github.com/kulshekhar/ts-jest/issues/2756)) ([5fbf43e](https://github.com/kulshekhar/ts-jest/commit/5fbf43e64691d5146add1da4690a14b3095c4234))
|
|
7
|
+
* add `babel-jest` as optional `peerDependencies` to solve yarn 2 ([#2751](https://github.com/kulshekhar/ts-jest/issues/2751)) ([8bede2e](https://github.com/kulshekhar/ts-jest/commit/8bede2e57546a18999b96871069f1f94a3ecf3c1))
|
|
8
|
+
* **config:** include AST transformer's `name` and `version` into cache key ([#2755](https://github.com/kulshekhar/ts-jest/issues/2755)) ([310fb9a](https://github.com/kulshekhar/ts-jest/commit/310fb9a1d7b40a8274d6fb93745e66a6da891a75)), closes [#2753](https://github.com/kulshekhar/ts-jest/issues/2753)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* link jest config types on `npx ts-jest:init` ([#2742](https://github.com/kulshekhar/ts-jest/issues/2742)) ([f51ba05](https://github.com/kulshekhar/ts-jest/commit/f51ba0507568ba8a5dece48c159d7857a2ed61d6))
|
|
14
|
+
* set env var `TS_JEST` to allow detecting of `ts-jest` ([#2717](https://github.com/kulshekhar/ts-jest/issues/2717)) ([56c137a](https://github.com/kulshekhar/ts-jest/commit/56c137a3c1906f49cb0b9e044fa8e233707cbaa4)), closes [#2716](https://github.com/kulshekhar/ts-jest/issues/2716)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
1
18
|
## [27.0.3](https://github.com/kulshekhar/ts-jest/compare/v27.0.2...v27.0.3) (2021-06-06)
|
|
2
19
|
|
|
3
20
|
|
package/dist/cli/config/init.js
CHANGED
|
@@ -119,6 +119,7 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
119
119
|
if (!jestPreset) {
|
|
120
120
|
content.push(preset.jsImport('tsjPreset') + ";", '');
|
|
121
121
|
}
|
|
122
|
+
content.push("/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */");
|
|
122
123
|
content.push('module.exports = {');
|
|
123
124
|
if (jestPreset) {
|
|
124
125
|
content.push(" preset: '" + preset.name + "',");
|
|
@@ -219,13 +219,23 @@ var ConfigSet = (function () {
|
|
|
219
219
|
this.resolvedTransformers.before = [require('../transformers/hoist-jest')];
|
|
220
220
|
var astTransformers = options.astTransformers;
|
|
221
221
|
if (astTransformers) {
|
|
222
|
+
var resolveTransformerFunc_1 = function (transformerPath) {
|
|
223
|
+
var transformerFunc = require(transformerPath);
|
|
224
|
+
if (!transformerFunc.version) {
|
|
225
|
+
_this.logger.warn("The AST transformer {{file}} must have an `export const version = <your_transformer_version>`", { file: transformerPath });
|
|
226
|
+
}
|
|
227
|
+
if (!transformerFunc.name) {
|
|
228
|
+
_this.logger.warn("The AST transformer {{file}} must have an `export const name = <your_transformer_name>`", { file: transformerPath });
|
|
229
|
+
}
|
|
230
|
+
return transformerFunc;
|
|
231
|
+
};
|
|
222
232
|
var resolveTransformers = function (transformers) {
|
|
223
233
|
return transformers.map(function (transformer) {
|
|
224
234
|
if (typeof transformer === 'string') {
|
|
225
|
-
return
|
|
235
|
+
return resolveTransformerFunc_1(_this.resolvePath(transformer, { nodeResolve: true }));
|
|
226
236
|
}
|
|
227
237
|
else {
|
|
228
|
-
return __assign(__assign({},
|
|
238
|
+
return __assign(__assign({}, resolveTransformerFunc_1(_this.resolvePath(transformer.path, { nodeResolve: true }))), { options: transformer.options });
|
|
229
239
|
}
|
|
230
240
|
});
|
|
231
241
|
};
|
|
@@ -253,14 +263,15 @@ var ConfigSet = (function () {
|
|
|
253
263
|
version: this.compilerModule.version,
|
|
254
264
|
digest: this.tsJestDigest,
|
|
255
265
|
babelConfig: this.babelConfig,
|
|
256
|
-
compilerModule: this.compilerModule,
|
|
257
266
|
tsconfig: {
|
|
258
267
|
options: this.parsedTsConfig.options,
|
|
259
268
|
raw: this.parsedTsConfig.raw,
|
|
260
269
|
},
|
|
261
270
|
isolatedModules: this.isolatedModules,
|
|
262
271
|
diagnostics: this._diagnostics,
|
|
263
|
-
transformers: this.resolvedTransformers
|
|
272
|
+
transformers: Object.values(this.resolvedTransformers)
|
|
273
|
+
.reduce(function (prevVal, currentVal) { return __spreadArray(__spreadArray([], __read(prevVal)), [currentVal]); })
|
|
274
|
+
.map(function (transformer) { return transformer.name + "-" + transformer.version; }),
|
|
264
275
|
}));
|
|
265
276
|
if (!this._jestCfg.cache) {
|
|
266
277
|
this.logger.debug('file caching disabled');
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const version = 1;
|
|
2
|
+
export declare const name = "hoist-jest";
|
|
@@ -32,8 +32,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
32
32
|
return to;
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.factory = void 0;
|
|
35
|
+
exports.factory = exports.name = exports.version = void 0;
|
|
36
36
|
var bs_logger_1 = require("bs-logger");
|
|
37
|
+
exports.version = 1;
|
|
38
|
+
exports.name = 'hoist-jest';
|
|
37
39
|
var HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock', 'deepUnmock'];
|
|
38
40
|
var JEST_GLOBALS_MODULE_NAME = '@jest/globals';
|
|
39
41
|
var JEST_GLOBAL_NAME = 'jest';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type * as _ts from 'typescript';
|
|
2
2
|
import type { TsCompilerInstance } from '../types';
|
|
3
|
+
export declare const version = 1;
|
|
4
|
+
export declare const name = "hoist-jest";
|
|
3
5
|
export declare function factory({ configSet, }: TsCompilerInstance): (ctx: _ts.TransformationContext) => _ts.Transformer<_ts.SourceFile>;
|
|
@@ -22,9 +22,11 @@ var __values = (this && this.__values) || function(o) {
|
|
|
22
22
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.factory = void 0;
|
|
25
|
+
exports.factory = exports.name = exports.version = void 0;
|
|
26
26
|
var path_1 = require("path");
|
|
27
27
|
var bs_logger_1 = require("bs-logger");
|
|
28
|
+
exports.version = 1;
|
|
29
|
+
exports.name = 'hoist-jest';
|
|
28
30
|
var isBaseDir = function (base, dir) { var _a; return !((_a = path_1.relative(base, dir)) === null || _a === void 0 ? void 0 : _a.startsWith('.')); };
|
|
29
31
|
function factory(_a) {
|
|
30
32
|
var _b;
|
|
@@ -59,6 +59,7 @@ var TsJestTransformer = (function () {
|
|
|
59
59
|
this.getCacheKey = this.getCacheKey.bind(this);
|
|
60
60
|
this.process = this.process.bind(this);
|
|
61
61
|
this._logger.debug('created new transformer');
|
|
62
|
+
process.env.TS_JEST = '1';
|
|
62
63
|
}
|
|
63
64
|
TsJestTransformer.prototype._configsFor = function (transformOptions) {
|
|
64
65
|
var config = transformOptions.config, cacheFS = transformOptions.cacheFS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -69,7 +69,21 @@
|
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"jest": "^27.0.0",
|
|
72
|
-
"typescript": ">=3.8 <5.0"
|
|
72
|
+
"typescript": ">=3.8 <5.0",
|
|
73
|
+
"babel-jest": ">=27.0.0 <28",
|
|
74
|
+
"@babel/core": ">=7.0.0-beta.0 <8",
|
|
75
|
+
"@types/jest": "^26.0.0"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"babel-jest": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@babel/core": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@types/jest": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
73
87
|
},
|
|
74
88
|
"husky": {
|
|
75
89
|
"hooks": {
|
|
@@ -92,7 +106,7 @@
|
|
|
92
106
|
"@types/lodash": "4.x",
|
|
93
107
|
"@types/micromatch": "4.x",
|
|
94
108
|
"@types/mkdirp": "latest",
|
|
95
|
-
"@types/node": "
|
|
109
|
+
"@types/node": "16.4.0",
|
|
96
110
|
"@types/node-fetch": "^2.5.8",
|
|
97
111
|
"@types/react": "17.x",
|
|
98
112
|
"@types/semver": "latest",
|
|
@@ -120,7 +134,7 @@
|
|
|
120
134
|
"lint-staged": "latest",
|
|
121
135
|
"node-fetch": "^2.6.1",
|
|
122
136
|
"npm-run-all": "latest",
|
|
123
|
-
"prettier": "2.3.
|
|
137
|
+
"prettier": "2.3.2",
|
|
124
138
|
"source-map": "latest",
|
|
125
139
|
"typescript": "~4.2.4"
|
|
126
140
|
},
|