ts-jest 26.5.2 → 26.5.6
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
|
+
23a45c3c610603c5fb7b5956ee7a94657fb32b21
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
## [26.5.6](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) (2021-05-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Code Refactoring
|
|
5
|
+
|
|
6
|
+
* refactor(config): show warning message for `sourceMap: false` ([#2557](https://github.com/kulshekhar/ts-jest/pull/2557)) ([cf60990](https://github.com/kulshekhar/ts-jest/commit/cf609900e2c5937755123bd08ca2c5f2ff5e0651)).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [26.5.5](https://github.com/kulshekhar/ts-jest/compare/v26.5.4...v26.5.5) (2021-04-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **compiler:** return file content on emitSkipped for non ts/tsx files ([#2515](https://github.com/kulshekhar/ts-jest/issues/2515)) ([0320fb3](https://github.com/kulshekhar/ts-jest/commit/0320fb3ac22056aafe4d7ae966eab84dbf23fda9)), closes [#2513](https://github.com/kulshekhar/ts-jest/issues/2513)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#2457](https://github.com/kulshekhar/ts-jest/issues/2457)) ([1dc731a](https://github.com/kulshekhar/ts-jest/commit/1dc731a5faf7cda59db1cc642eb99fae973b1246)), closes [#2445](https://github.com/kulshekhar/ts-jest/issues/2445)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **config:** create fallback jest config when jest config is undefined ([#2421](https://github.com/kulshekhar/ts-jest/issues/2421)) ([0fb6b45](https://github.com/kulshekhar/ts-jest/commit/0fb6b45e7dc3dd7588d27f09ac9a8849dff470cb)), closes [#2085](https://github.com/kulshekhar/ts-jest/issues/2085)
|
|
34
|
+
* remove `@types/jest` from direct dep ([#2416](https://github.com/kulshekhar/ts-jest/issues/2416)) ([060302e](https://github.com/kulshekhar/ts-jest/commit/060302ed1eb8708df0acd7ab1d613ff06fc08cf3)), closes [#2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#2411](https://github.com/kulshekhar/ts-jest/issues/2411)
|
|
35
|
+
* **compiler:** return original file content on emit skip ([#2408](https://github.com/kulshekhar/ts-jest/issues/2408)) ([cfba8f4](https://github.com/kulshekhar/ts-jest/commit/cfba8f423dd59536d8b1e1374ef2b20bff2ed857)), closes [#2407](https://github.com/kulshekhar/ts-jest/issues/2407)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
1
39
|
## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
|
|
2
40
|
|
|
3
41
|
|
|
@@ -73,7 +73,6 @@ var fs_1 = require("fs");
|
|
|
73
73
|
var path_1 = require("path");
|
|
74
74
|
var memoize = require("lodash/memoize");
|
|
75
75
|
var mkdirp = require("mkdirp");
|
|
76
|
-
var config_set_1 = require("../config/config-set");
|
|
77
76
|
var constants_1 = require("../constants");
|
|
78
77
|
var messages_1 = require("../utils/messages");
|
|
79
78
|
var json_1 = require("../utils/json");
|
|
@@ -114,7 +113,7 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
|
|
|
114
113
|
catch (e) { }
|
|
115
114
|
}
|
|
116
115
|
configs.parsedTsConfig.fileNames
|
|
117
|
-
.filter(function (fileName) {
|
|
116
|
+
.filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(path_1.extname(fileName)) && !configs.isTestFile(fileName); })
|
|
118
117
|
.forEach(function (fileName) {
|
|
119
118
|
memoryCache.files.set(fileName, {
|
|
120
119
|
version: 0,
|
|
@@ -267,7 +266,13 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
|
|
|
267
266
|
}
|
|
268
267
|
}
|
|
269
268
|
if (output.emitSkipped) {
|
|
270
|
-
|
|
269
|
+
if (constants_1.TS_TSX_REGEX.test(fileName)) {
|
|
270
|
+
throw new Error(messages_1.interpolate("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}}", { file: fileName }));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
logger.warn(messages_1.interpolate("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 `'.'`", { file: fileName }));
|
|
274
|
+
return [code, '{}'];
|
|
275
|
+
}
|
|
271
276
|
}
|
|
272
277
|
if (!output.outputFiles.length) {
|
|
273
278
|
throw new TypeError(messages_1.interpolate("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}}`.", {
|
|
@@ -4,7 +4,6 @@ import { CompilerOptions, CustomTransformers, Diagnostic, ParsedCommandLine } fr
|
|
|
4
4
|
import type { TTypeScript } from '../types';
|
|
5
5
|
import type { RawCompilerOptions } from '../tsconfig-raw';
|
|
6
6
|
export declare class ConfigSet {
|
|
7
|
-
private readonly jestConfig;
|
|
8
7
|
private readonly parentLogger?;
|
|
9
8
|
readonly logger: Logger;
|
|
10
9
|
readonly compilerModule: TTypeScript;
|
|
@@ -15,7 +14,7 @@ export declare class ConfigSet {
|
|
|
15
14
|
customTransformers: CustomTransformers;
|
|
16
15
|
readonly rootDir: string;
|
|
17
16
|
protected _overriddenCompilerOptions: Partial<CompilerOptions>;
|
|
18
|
-
constructor(jestConfig: Config.ProjectConfig, parentLogger?: Logger | undefined);
|
|
17
|
+
constructor(jestConfig: Config.ProjectConfig | undefined, parentLogger?: Logger | undefined);
|
|
19
18
|
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): Record<string, any>;
|
|
20
19
|
get tsJestDigest(): string;
|
|
21
20
|
isTestFile(fileName: string): boolean;
|
|
@@ -119,7 +119,6 @@ var ConfigSet = (function () {
|
|
|
119
119
|
function ConfigSet(jestConfig, parentLogger) {
|
|
120
120
|
var _a, _b;
|
|
121
121
|
var _c, _d, _e, _f;
|
|
122
|
-
this.jestConfig = jestConfig;
|
|
123
122
|
this.parentLogger = parentLogger;
|
|
124
123
|
this.customTransformers = Object.create(null);
|
|
125
124
|
this._overriddenCompilerOptions = {
|
|
@@ -141,14 +140,14 @@ var ConfigSet = (function () {
|
|
|
141
140
|
this.logger = this.parentLogger
|
|
142
141
|
? this.parentLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'config', _a))
|
|
143
142
|
: logger_1.rootLogger.child({ namespace: 'config' });
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
|
|
143
|
+
this._backportJestCfg(jestConfig !== null && jestConfig !== void 0 ? jestConfig : Object.create(null));
|
|
144
|
+
this.cwd = path_1.normalize((_c = this._jestCfg.cwd) !== null && _c !== void 0 ? _c : process.cwd());
|
|
145
|
+
this.rootDir = path_1.normalize((_d = this._jestCfg.rootDir) !== null && _d !== void 0 ? _d : this.cwd);
|
|
146
|
+
var tsJestCfg = this._jestCfg.globals && this._jestCfg.globals['ts-jest'];
|
|
147
147
|
var options = tsJestCfg !== null && tsJestCfg !== void 0 ? tsJestCfg : Object.create(null);
|
|
148
148
|
this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", (_e = options.compiler) !== null && _e !== void 0 ? _e : 'typescript');
|
|
149
149
|
this.isolatedModules = (_f = options.isolatedModules) !== null && _f !== void 0 ? _f : false;
|
|
150
150
|
this.logger.debug({ compilerModule: this.compilerModule }, 'normalized compiler module config via ts-jest option');
|
|
151
|
-
this._backportJestCfg();
|
|
152
151
|
this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
|
|
153
152
|
return pattern instanceof RegExp || typeof pattern === 'string';
|
|
154
153
|
});
|
|
@@ -159,8 +158,8 @@ var ConfigSet = (function () {
|
|
|
159
158
|
this._setupTsJestCfg(options);
|
|
160
159
|
this._resolveTsCacheDir();
|
|
161
160
|
}
|
|
162
|
-
ConfigSet.prototype._backportJestCfg = function () {
|
|
163
|
-
var config = backports_1.backportJestConfig(this.logger,
|
|
161
|
+
ConfigSet.prototype._backportJestCfg = function (jestCfg) {
|
|
162
|
+
var config = backports_1.backportJestConfig(this.logger, jestCfg);
|
|
164
163
|
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
|
165
164
|
this._jestCfg = config;
|
|
166
165
|
};
|
|
@@ -331,6 +330,11 @@ var ConfigSet = (function () {
|
|
|
331
330
|
}
|
|
332
331
|
config.compilerOptions = __assign(__assign({}, config.compilerOptions), compilerOptions);
|
|
333
332
|
var result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
|
|
333
|
+
if (result.options.sourceMap === false) {
|
|
334
|
+
this.logger.warn(messages_1.interpolate("Got `sourceMap: false` from tsconfig file \"{{path}}\". This will disable source map support in ts-jest 27. Please set `sourceMap: true` in your tsconfig file \"{{path}}\" if you want to keep source map support on", {
|
|
335
|
+
path: result.options.configFilePath,
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
334
338
|
var forcedOptions = this._overriddenCompilerOptions;
|
|
335
339
|
var finalOptions = result.options;
|
|
336
340
|
if (finalOptions.target === undefined) {
|
package/dist/utils/backports.js
CHANGED
|
@@ -15,11 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.backportTsJestDebugEnvVar = exports.backportJestConfig = void 0;
|
|
16
16
|
var bs_logger_1 = require("bs-logger");
|
|
17
17
|
var messages_1 = require("./messages");
|
|
18
|
+
var constants_1 = require("../constants");
|
|
18
19
|
var context = (_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'backports', _a);
|
|
19
20
|
exports.backportJestConfig = function (logger, config) {
|
|
21
|
+
var _a, _b;
|
|
20
22
|
logger.debug(__assign(__assign({}, context), { config: config }), 'backporting config');
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
+
var _c = (config || {}).globals, globals = _c === void 0 ? {} : _c;
|
|
24
|
+
var _d = globals["ts-jest"], tsJest = _d === void 0 ? {} : _d;
|
|
23
25
|
var mergeTsJest = {};
|
|
24
26
|
var hadWarnings = false;
|
|
25
27
|
var warnConfig = function (oldPath, newPath, note) {
|
|
@@ -85,7 +87,7 @@ exports.backportJestConfig = function (logger, config) {
|
|
|
85
87
|
if (hadWarnings) {
|
|
86
88
|
logger.warn(context, "Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.");
|
|
87
89
|
}
|
|
88
|
-
return __assign(__assign({}, config), { globals: __assign(__assign({}, globals), { 'ts-jest': __assign(__assign({}, mergeTsJest), tsJest) }) });
|
|
90
|
+
return __assign(__assign({}, config), { testMatch: (_a = config.testMatch) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_JEST_TEST_MATCH, testRegex: (_b = config.testRegex) !== null && _b !== void 0 ? _b : [], globals: __assign(__assign({}, globals), { 'ts-jest': __assign(__assign({}, mergeTsJest), tsJest) }) });
|
|
89
91
|
};
|
|
90
92
|
exports.backportTsJestDebugEnvVar = function (logger) {
|
|
91
93
|
if ('TS_JEST_DEBUG' in process.env) {
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare let rootLogger: import("bs-logger/dist/logger").Logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "26.5.
|
|
3
|
+
"version": "26.5.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://kulshekhar.github.io/ts-jest",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@types/jest": "26.x",
|
|
62
61
|
"bs-logger": "0.x",
|
|
63
62
|
"buffer-from": "1.x",
|
|
64
63
|
"fast-json-stable-stringify": "2.x",
|
|
@@ -90,6 +89,7 @@
|
|
|
90
89
|
"@types/buffer-from": "latest",
|
|
91
90
|
"@types/cross-spawn": "latest",
|
|
92
91
|
"@types/fs-extra": "latest",
|
|
92
|
+
"@types/jest": "26.x",
|
|
93
93
|
"@types/js-yaml": "latest",
|
|
94
94
|
"@types/json5": "latest",
|
|
95
95
|
"@types/lodash": "4.x",
|