ts-jest 26.0.0 → 26.1.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 +17 -0
- package/dist/cli/config/init.js +1 -0
- package/dist/cli/config/migrate.js +1 -0
- package/dist/cli/help.js +1 -0
- package/dist/cli/helpers/presets.js +6 -4
- package/dist/cli/index.js +1 -0
- package/dist/compiler/compiler-utils.js +1 -0
- package/dist/compiler/instance.js +1 -0
- package/dist/compiler/language-service.js +1 -0
- package/dist/compiler/transpiler.js +1 -0
- package/dist/config/config-set.js +40 -28
- package/dist/config/create-jest-preset.d.ts +1 -5
- package/dist/config/create-jest-preset.js +1 -0
- package/dist/config/paths-to-module-name-mapper.d.ts +4 -3
- package/dist/config/paths-to-module-name-mapper.js +5 -9
- package/dist/constants.js +1 -0
- package/dist/index.d.ts +111 -1
- package/dist/index.js +1 -0
- package/dist/transformers/hoist-jest.js +1 -0
- package/dist/transformers/index.js +1 -0
- package/dist/ts-jest-transformer.js +2 -1
- package/dist/types.d.ts +3 -1
- package/dist/util/backports.js +1 -0
- package/dist/util/exported.js +3 -3
- package/dist/util/get-package-version.js +1 -0
- package/dist/util/importer.js +2 -1
- package/dist/util/json.js +1 -0
- package/dist/util/jsonable-value.js +3 -2
- package/dist/util/logger.js +1 -0
- package/dist/util/memoize.js +1 -0
- package/dist/util/messages.js +1 -0
- package/dist/util/normalize-slashes.js +1 -0
- package/dist/util/sha1.js +1 -0
- package/dist/util/testing.js +1 -0
- package/dist/util/ts-error.js +1 -0
- package/dist/util/version-checkers.js +1 -0
- package/jest-base.js +12 -0
- package/package.json +5 -9
- package/tsconfig.spec.json +4 -0
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
eeca777d22e47cf3d4ed72c46ec92618ae5691f9
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
<a name="26.1.0"></a>
|
|
2
|
+
# [26.1.0](https://github.com/kulshekhar/ts-jest/compare/v26.0.0...v26.1.0) (2020-05-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **typing:** don't mark `BabelConfig` as internal type ([#1667](https://github.com/kulshekhar/ts-jest/issues/1667)) ([558c307](https://github.com/kulshekhar/ts-jest/commit/558c307)), closes [#1666](https://github.com/kulshekhar/ts-jest/issues/1666)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **config:** show a warning message when TypeScript `target` version doesn't match with recommended NodeJs version ([#1678](https://github.com/kulshekhar/ts-jest/issues/1678)) ([085bdf5](https://github.com/kulshekhar/ts-jest/commit/085bdf5))
|
|
13
|
+
* **config:** support multiple paths for `pathsToModuleNameMapper` ([#1690](https://github.com/kulshekhar/ts-jest/issues/1690)) ([a727bd5](https://github.com/kulshekhar/ts-jest/commit/a727bd5))
|
|
14
|
+
* support TypeScript 3.9 ([#1653](https://github.com/kulshekhar/ts-jest/issues/1653)) ([fc3d5ad](https://github.com/kulshekhar/ts-jest/commit/fc3d5ad))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
1
18
|
<a name="26.0.0"></a>
|
|
2
19
|
# [26.0.0](https://github.com/kulshekhar/ts-jest/compare/v25.5.1...v26.0.0) (2020-05-15)
|
|
3
20
|
|
package/dist/cli/config/init.js
CHANGED
|
@@ -47,6 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.help = exports.run = void 0;
|
|
50
51
|
var fs_1 = require("fs");
|
|
51
52
|
var json5_1 = require("json5");
|
|
52
53
|
var path_1 = require("path");
|
|
@@ -56,6 +56,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
56
56
|
return ar;
|
|
57
57
|
};
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.help = exports.run = void 0;
|
|
59
60
|
var bs_logger_1 = require("bs-logger");
|
|
60
61
|
var stableStringify = require("fast-json-stable-stringify");
|
|
61
62
|
var fs_1 = require("fs");
|
package/dist/cli/help.js
CHANGED
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.help = exports.run = void 0;
|
|
39
40
|
exports.run = function (_) { return __awaiter(void 0, void 0, void 0, function () {
|
|
40
41
|
return __generator(this, function (_a) {
|
|
41
42
|
process.stdout.write("\nUsage:\n ts-jest command [options] [...args]\n\nCommands:\n config:init Creates initial Jest configuration\n config:migrate Migrates a given Jest configuration\n help [command] Show this help, or help about a command\n\nExample:\n ts-jest help config:migrate\n");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsWIthBabel = exports.jsWithTs = exports.defaults = exports.allPresets = void 0;
|
|
3
4
|
var definePreset = function (fullName) { return ({
|
|
4
5
|
fullName: fullName,
|
|
5
6
|
get name() {
|
|
@@ -11,10 +12,11 @@ var definePreset = function (fullName) { return ({
|
|
|
11
12
|
get jsVarName() {
|
|
12
13
|
return this.isDefault
|
|
13
14
|
? 'defaults'
|
|
14
|
-
:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
:
|
|
16
|
+
fullName
|
|
17
|
+
.split('/')
|
|
18
|
+
.pop()
|
|
19
|
+
.replace(/\-([a-z])/g, function (_, l) { return l.toUpperCase(); });
|
|
18
20
|
},
|
|
19
21
|
get value() {
|
|
20
22
|
return require("../../../" + fullName.replace(/^ts-jest\//, '') + "/jest-preset");
|
package/dist/cli/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
var _a;
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.processArgv = void 0;
|
|
40
41
|
var bs_logger_1 = require("bs-logger");
|
|
41
42
|
var yargsParser = require("yargs-parser");
|
|
42
43
|
var logger_1 = require("../util/logger");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTestFile = exports.cacheResolvedModules = exports.getResolvedModulesCache = void 0;
|
|
3
4
|
var fs_1 = require("fs");
|
|
4
5
|
var micromatch = require("micromatch");
|
|
5
6
|
var path_1 = require("path");
|
|
@@ -27,6 +27,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.createCompilerInstance = void 0;
|
|
30
31
|
var fs_1 = require("fs");
|
|
31
32
|
var mkdirp = require("mkdirp");
|
|
32
33
|
var path_1 = require("path");
|
|
@@ -20,6 +20,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
20
20
|
return ar;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.initializeLanguageServiceInstance = void 0;
|
|
23
24
|
var bs_logger_1 = require("bs-logger");
|
|
24
25
|
var path_1 = require("path");
|
|
25
26
|
var constants_1 = require("../constants");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeTranspilerInstance = void 0;
|
|
3
4
|
exports.initializeTranspilerInstance = function (configs, memoryCache, logger) {
|
|
4
5
|
logger.debug('initializeTranspilerInstance(): create typescript compiler');
|
|
5
6
|
var _a = configs.parsedTsConfig, options = _a.options, fileNames = _a.fileNames;
|
|
@@ -48,10 +48,12 @@ var __spread = (this && this.__spread) || function () {
|
|
|
48
48
|
return ar;
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.ConfigSet = exports.TS_JEST_OUT_DIR = exports.IGNORE_DIAGNOSTIC_CODES = exports.MATCH_NOTHING = void 0;
|
|
51
52
|
var bs_logger_1 = require("bs-logger");
|
|
52
53
|
var fs_1 = require("fs");
|
|
53
54
|
var json5 = require("json5");
|
|
54
55
|
var path_1 = require("path");
|
|
56
|
+
var typescript_1 = require("typescript");
|
|
55
57
|
var __1 = require("..");
|
|
56
58
|
var instance_1 = require("../compiler/instance");
|
|
57
59
|
var constants_1 = require("../constants");
|
|
@@ -154,7 +156,7 @@ var ConfigSet = (function () {
|
|
|
154
156
|
this.logger.warn("Unable to find the root of the project where ts-jest has been installed.");
|
|
155
157
|
return {};
|
|
156
158
|
},
|
|
157
|
-
enumerable:
|
|
159
|
+
enumerable: false,
|
|
158
160
|
configurable: true
|
|
159
161
|
});
|
|
160
162
|
Object.defineProperty(ConfigSet.prototype, "projectDependencies", {
|
|
@@ -168,7 +170,7 @@ var ConfigSet = (function () {
|
|
|
168
170
|
return map;
|
|
169
171
|
}, {});
|
|
170
172
|
},
|
|
171
|
-
enumerable:
|
|
173
|
+
enumerable: false,
|
|
172
174
|
configurable: true
|
|
173
175
|
});
|
|
174
176
|
Object.defineProperty(ConfigSet.prototype, "jest", {
|
|
@@ -182,7 +184,7 @@ var ConfigSet = (function () {
|
|
|
182
184
|
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
|
183
185
|
return config;
|
|
184
186
|
},
|
|
185
|
-
enumerable:
|
|
187
|
+
enumerable: false,
|
|
186
188
|
configurable: true
|
|
187
189
|
});
|
|
188
190
|
Object.defineProperty(ConfigSet.prototype, "testMatchPatterns", {
|
|
@@ -195,7 +197,7 @@ var ConfigSet = (function () {
|
|
|
195
197
|
}
|
|
196
198
|
return matchablePatterns;
|
|
197
199
|
},
|
|
198
|
-
enumerable:
|
|
200
|
+
enumerable: false,
|
|
199
201
|
configurable: true
|
|
200
202
|
});
|
|
201
203
|
Object.defineProperty(ConfigSet.prototype, "tsJest", {
|
|
@@ -286,14 +288,14 @@ var ConfigSet = (function () {
|
|
|
286
288
|
this.logger.debug({ tsJestConfig: res }, 'normalized ts-jest config');
|
|
287
289
|
return res;
|
|
288
290
|
},
|
|
289
|
-
enumerable:
|
|
291
|
+
enumerable: false,
|
|
290
292
|
configurable: true
|
|
291
293
|
});
|
|
292
294
|
Object.defineProperty(ConfigSet.prototype, "parsedTsConfig", {
|
|
293
295
|
get: function () {
|
|
294
296
|
return this._parsedTsConfig;
|
|
295
297
|
},
|
|
296
|
-
enumerable:
|
|
298
|
+
enumerable: false,
|
|
297
299
|
configurable: true
|
|
298
300
|
});
|
|
299
301
|
Object.defineProperty(ConfigSet.prototype, "versions", {
|
|
@@ -308,7 +310,7 @@ var ConfigSet = (function () {
|
|
|
308
310
|
return map;
|
|
309
311
|
}, { 'ts-jest': __1.version });
|
|
310
312
|
},
|
|
311
|
-
enumerable:
|
|
313
|
+
enumerable: false,
|
|
312
314
|
configurable: true
|
|
313
315
|
});
|
|
314
316
|
Object.defineProperty(ConfigSet.prototype, "_parsedTsConfig", {
|
|
@@ -320,7 +322,7 @@ var ConfigSet = (function () {
|
|
|
320
322
|
this.logger.debug({ tsconfig: result }, 'normalized typescript config');
|
|
321
323
|
return result;
|
|
322
324
|
},
|
|
323
|
-
enumerable:
|
|
325
|
+
enumerable: false,
|
|
324
326
|
configurable: true
|
|
325
327
|
});
|
|
326
328
|
Object.defineProperty(ConfigSet.prototype, "raiseDiagnostics", {
|
|
@@ -340,7 +342,7 @@ var ConfigSet = (function () {
|
|
|
340
342
|
logger.warn({ error: error }, error.message);
|
|
341
343
|
};
|
|
342
344
|
},
|
|
343
|
-
enumerable:
|
|
345
|
+
enumerable: false,
|
|
344
346
|
configurable: true
|
|
345
347
|
});
|
|
346
348
|
Object.defineProperty(ConfigSet.prototype, "babel", {
|
|
@@ -367,14 +369,14 @@ var ConfigSet = (function () {
|
|
|
367
369
|
this.logger.debug({ babelConfig: base }, 'normalized babel config via ts-jest option');
|
|
368
370
|
return base;
|
|
369
371
|
},
|
|
370
|
-
enumerable:
|
|
372
|
+
enumerable: false,
|
|
371
373
|
configurable: true
|
|
372
374
|
});
|
|
373
375
|
Object.defineProperty(ConfigSet.prototype, "compilerModule", {
|
|
374
376
|
get: function () {
|
|
375
377
|
return importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", this.tsJest.compiler);
|
|
376
378
|
},
|
|
377
|
-
enumerable:
|
|
379
|
+
enumerable: false,
|
|
378
380
|
configurable: true
|
|
379
381
|
});
|
|
380
382
|
Object.defineProperty(ConfigSet.prototype, "babelJestTransformer", {
|
|
@@ -385,21 +387,21 @@ var ConfigSet = (function () {
|
|
|
385
387
|
this.logger.debug('creating babel-jest transformer');
|
|
386
388
|
return importer_1.importer.babelJest("Using \"babel-jest\" requires this package to be installed.").createTransformer(babel);
|
|
387
389
|
},
|
|
388
|
-
enumerable:
|
|
390
|
+
enumerable: false,
|
|
389
391
|
configurable: true
|
|
390
392
|
});
|
|
391
393
|
Object.defineProperty(ConfigSet.prototype, "tsCompiler", {
|
|
392
394
|
get: function () {
|
|
393
395
|
return instance_1.createCompilerInstance(this);
|
|
394
396
|
},
|
|
395
|
-
enumerable:
|
|
397
|
+
enumerable: false,
|
|
396
398
|
configurable: true
|
|
397
399
|
});
|
|
398
400
|
Object.defineProperty(ConfigSet.prototype, "astTransformers", {
|
|
399
401
|
get: function () {
|
|
400
402
|
return __spread(transformers_1.internals, this.tsJest.transformers.map(function (m) { return require(m); }));
|
|
401
403
|
},
|
|
402
|
-
enumerable:
|
|
404
|
+
enumerable: false,
|
|
403
405
|
configurable: true
|
|
404
406
|
});
|
|
405
407
|
Object.defineProperty(ConfigSet.prototype, "tsCustomTransformers", {
|
|
@@ -409,7 +411,7 @@ var ConfigSet = (function () {
|
|
|
409
411
|
before: this.astTransformers.map(function (t) { return t.factory(_this); }),
|
|
410
412
|
};
|
|
411
413
|
},
|
|
412
|
-
enumerable:
|
|
414
|
+
enumerable: false,
|
|
413
415
|
configurable: true
|
|
414
416
|
});
|
|
415
417
|
Object.defineProperty(ConfigSet.prototype, "hooks", {
|
|
@@ -421,7 +423,7 @@ var ConfigSet = (function () {
|
|
|
421
423
|
}
|
|
422
424
|
return {};
|
|
423
425
|
},
|
|
424
|
-
enumerable:
|
|
426
|
+
enumerable: false,
|
|
425
427
|
configurable: true
|
|
426
428
|
});
|
|
427
429
|
Object.defineProperty(ConfigSet.prototype, "filterDiagnostics", {
|
|
@@ -439,7 +441,7 @@ var ConfigSet = (function () {
|
|
|
439
441
|
});
|
|
440
442
|
};
|
|
441
443
|
},
|
|
442
|
-
enumerable:
|
|
444
|
+
enumerable: false,
|
|
443
445
|
configurable: true
|
|
444
446
|
});
|
|
445
447
|
Object.defineProperty(ConfigSet.prototype, "shouldReportDiagnostic", {
|
|
@@ -453,7 +455,7 @@ var ConfigSet = (function () {
|
|
|
453
455
|
return function () { return true; };
|
|
454
456
|
}
|
|
455
457
|
},
|
|
456
|
-
enumerable:
|
|
458
|
+
enumerable: false,
|
|
457
459
|
configurable: true
|
|
458
460
|
});
|
|
459
461
|
Object.defineProperty(ConfigSet.prototype, "shouldStringifyContent", {
|
|
@@ -467,7 +469,7 @@ var ConfigSet = (function () {
|
|
|
467
469
|
return function () { return false; };
|
|
468
470
|
}
|
|
469
471
|
},
|
|
470
|
-
enumerable:
|
|
472
|
+
enumerable: false,
|
|
471
473
|
configurable: true
|
|
472
474
|
});
|
|
473
475
|
Object.defineProperty(ConfigSet.prototype, "createTsError", {
|
|
@@ -488,7 +490,7 @@ var ConfigSet = (function () {
|
|
|
488
490
|
return new ts_error_1.TSError(diagnosticText, diagnosticCodes);
|
|
489
491
|
};
|
|
490
492
|
},
|
|
491
|
-
enumerable:
|
|
493
|
+
enumerable: false,
|
|
492
494
|
configurable: true
|
|
493
495
|
});
|
|
494
496
|
Object.defineProperty(ConfigSet.prototype, "tsCacheDir", {
|
|
@@ -510,7 +512,7 @@ var ConfigSet = (function () {
|
|
|
510
512
|
logger.debug({ cacheDirectory: res }, 'will use file caching');
|
|
511
513
|
return res;
|
|
512
514
|
},
|
|
513
|
-
enumerable:
|
|
515
|
+
enumerable: false,
|
|
514
516
|
configurable: true
|
|
515
517
|
});
|
|
516
518
|
Object.defineProperty(ConfigSet.prototype, "overriddenCompilerOptions", {
|
|
@@ -536,28 +538,28 @@ var ConfigSet = (function () {
|
|
|
536
538
|
}
|
|
537
539
|
return options;
|
|
538
540
|
},
|
|
539
|
-
enumerable:
|
|
541
|
+
enumerable: false,
|
|
540
542
|
configurable: true
|
|
541
543
|
});
|
|
542
544
|
Object.defineProperty(ConfigSet.prototype, "rootDir", {
|
|
543
545
|
get: function () {
|
|
544
546
|
return path_1.normalize(this.jest.rootDir || this.cwd);
|
|
545
547
|
},
|
|
546
|
-
enumerable:
|
|
548
|
+
enumerable: false,
|
|
547
549
|
configurable: true
|
|
548
550
|
});
|
|
549
551
|
Object.defineProperty(ConfigSet.prototype, "cwd", {
|
|
550
552
|
get: function () {
|
|
551
553
|
return path_1.normalize(this.jest.cwd || process.cwd());
|
|
552
554
|
},
|
|
553
|
-
enumerable:
|
|
555
|
+
enumerable: false,
|
|
554
556
|
configurable: true
|
|
555
557
|
});
|
|
556
558
|
Object.defineProperty(ConfigSet.prototype, "tsJestDigest", {
|
|
557
559
|
get: function () {
|
|
558
560
|
return __1.digest;
|
|
559
561
|
},
|
|
560
|
-
enumerable:
|
|
562
|
+
enumerable: false,
|
|
561
563
|
configurable: true
|
|
562
564
|
});
|
|
563
565
|
Object.defineProperty(ConfigSet.prototype, "jsonValue", {
|
|
@@ -578,14 +580,14 @@ var ConfigSet = (function () {
|
|
|
578
580
|
tsconfig: this.parsedTsConfig.options,
|
|
579
581
|
});
|
|
580
582
|
},
|
|
581
|
-
enumerable:
|
|
583
|
+
enumerable: false,
|
|
582
584
|
configurable: true
|
|
583
585
|
});
|
|
584
586
|
Object.defineProperty(ConfigSet.prototype, "cacheKey", {
|
|
585
587
|
get: function () {
|
|
586
588
|
return this.jsonValue.serialized;
|
|
587
589
|
},
|
|
588
|
-
enumerable:
|
|
590
|
+
enumerable: false,
|
|
589
591
|
configurable: true
|
|
590
592
|
});
|
|
591
593
|
ConfigSet.prototype.makeDiagnostic = function (code, messageText, options) {
|
|
@@ -602,7 +604,7 @@ var ConfigSet = (function () {
|
|
|
602
604
|
};
|
|
603
605
|
ConfigSet.prototype.readTsConfig = function (compilerOptions, resolvedConfigFile, noProject) {
|
|
604
606
|
var e_2, _a;
|
|
605
|
-
var config = { compilerOptions:
|
|
607
|
+
var config = { compilerOptions: Object.create(null) };
|
|
606
608
|
var basePath = normalize_slashes_1.normalizeSlashes(this.rootDir);
|
|
607
609
|
var configFileName;
|
|
608
610
|
var ts = this.compilerModule;
|
|
@@ -664,6 +666,16 @@ var ConfigSet = (function () {
|
|
|
664
666
|
}
|
|
665
667
|
finally { if (e_2) throw e_2.error; }
|
|
666
668
|
}
|
|
669
|
+
var nodeJsVer = process.version;
|
|
670
|
+
var compilationTarget = result.options.target;
|
|
671
|
+
if ((nodeJsVer.startsWith('v10') && compilationTarget > typescript_1.ScriptTarget.ES2018) ||
|
|
672
|
+
(nodeJsVer.startsWith('v12') && compilationTarget > typescript_1.ScriptTarget.ES2019)) {
|
|
673
|
+
var message = messages_1.interpolate("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", {
|
|
674
|
+
nodeJsVer: process.version,
|
|
675
|
+
compilationTarget: config.compilerOptions.target,
|
|
676
|
+
});
|
|
677
|
+
logger.warn(message);
|
|
678
|
+
}
|
|
667
679
|
return result;
|
|
668
680
|
};
|
|
669
681
|
ConfigSet.prototype.resolvePath = function (inputPath, _a) {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Config } from '@jest/types';
|
|
2
|
-
export
|
|
3
|
-
transform: Config.InitialOptions['transform'];
|
|
4
|
-
testMatch?: string[];
|
|
5
|
-
moduleFileExtensions?: string[];
|
|
6
|
-
}
|
|
2
|
+
export declare type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>;
|
|
7
3
|
export interface CreateJestPresetOptions {
|
|
8
4
|
allowJs?: boolean;
|
|
9
5
|
}
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.createJestPreset = void 0;
|
|
14
15
|
var logger_1 = require("../util/logger");
|
|
15
16
|
var logger = logger_1.rootLogger.child({ namespace: 'jest-preset' });
|
|
16
17
|
function createJestPreset(_a, from) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Config } from '@jest/types';
|
|
2
|
+
declare type JestPathMapping = Config.InitialOptions['moduleNameMapper'];
|
|
1
3
|
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix }?: {
|
|
2
4
|
prefix?: string | undefined;
|
|
3
|
-
}) =>
|
|
4
|
-
|
|
5
|
-
} | undefined;
|
|
5
|
+
}) => JestPathMapping;
|
|
6
|
+
export {};
|
|
@@ -12,6 +12,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
};
|
|
13
13
|
var _a;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.pathsToModuleNameMapper = void 0;
|
|
15
16
|
var bs_logger_1 = require("bs-logger");
|
|
16
17
|
var logger_1 = require("../util/logger");
|
|
17
18
|
var messages_1 = require("../util/messages");
|
|
@@ -30,21 +31,16 @@ exports.pathsToModuleNameMapper = function (mapping, _a) {
|
|
|
30
31
|
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has no target.", { path: fromPath }));
|
|
31
32
|
continue;
|
|
32
33
|
}
|
|
33
|
-
else if (toPaths.length > 1) {
|
|
34
|
-
logger.warn(messages_1.interpolate("Mapping only to first target of \"{{path}}\" because it has more than one ({{count}}).", {
|
|
35
|
-
path: fromPath,
|
|
36
|
-
count: toPaths.length,
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
var target = toPaths[0];
|
|
40
34
|
var segments = fromPath.split(/\*/g);
|
|
41
35
|
if (segments.length === 1) {
|
|
36
|
+
var paths = toPaths.map(function (target) { return "" + prefix + target; });
|
|
42
37
|
pattern = "^" + escapeRegex(fromPath) + "$";
|
|
43
|
-
jestMap[pattern] =
|
|
38
|
+
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
|
44
39
|
}
|
|
45
40
|
else if (segments.length === 2) {
|
|
41
|
+
var paths = toPaths.map(function (target) { return "" + prefix + target.replace(/\*/g, '$1'); });
|
|
46
42
|
pattern = "^" + escapeRegex(segments[0]) + "(.*)" + escapeRegex(segments[1]) + "$";
|
|
47
|
-
jestMap[pattern] =
|
|
43
|
+
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
|
48
44
|
}
|
|
49
45
|
else {
|
|
50
46
|
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has more than one star (`*`).", { path: fromPath }));
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_JEST_TEST_MATCH = exports.JSON_REGEX = exports.JS_JSX_REGEX = exports.TS_TSX_REGEX = exports.EXTENSION_REGEX = exports.LINE_FEED = void 0;
|
|
3
4
|
exports.LINE_FEED = '\n';
|
|
4
5
|
exports.EXTENSION_REGEX = /\.[^.]+$/;
|
|
5
6
|
exports.TS_TSX_REGEX = /\.tsx?$/;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,115 @@ export declare const pathsToModuleNameMapper: (mapping: import("typescript").Map
|
|
|
19
19
|
export declare const version: string;
|
|
20
20
|
export declare const digest: string;
|
|
21
21
|
export declare function createTransformer(baseConfig?: TsJestGlobalOptions): TsJestTransformer;
|
|
22
|
-
declare const jestPreset:
|
|
22
|
+
declare const jestPreset: Pick<Partial<{
|
|
23
|
+
automock: boolean;
|
|
24
|
+
bail: number | boolean;
|
|
25
|
+
cache: boolean;
|
|
26
|
+
cacheDirectory: string;
|
|
27
|
+
clearMocks: boolean;
|
|
28
|
+
changedFilesWithAncestor: boolean;
|
|
29
|
+
changedSince: string;
|
|
30
|
+
collectCoverage: boolean;
|
|
31
|
+
collectCoverageFrom: string[];
|
|
32
|
+
collectCoverageOnlyFrom: {
|
|
33
|
+
[key: string]: boolean;
|
|
34
|
+
};
|
|
35
|
+
coverageDirectory: string;
|
|
36
|
+
coveragePathIgnorePatterns: string[];
|
|
37
|
+
coverageProvider: "babel" | "v8";
|
|
38
|
+
coverageReporters: string[];
|
|
39
|
+
coverageThreshold: {
|
|
40
|
+
global: {
|
|
41
|
+
[key: string]: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
dependencyExtractor: string;
|
|
45
|
+
detectLeaks: boolean;
|
|
46
|
+
detectOpenHandles: boolean;
|
|
47
|
+
displayName: import("@jest/types/build/Config").DisplayName;
|
|
48
|
+
expand: boolean;
|
|
49
|
+
extraGlobals: string[];
|
|
50
|
+
filter: string;
|
|
51
|
+
findRelatedTests: boolean;
|
|
52
|
+
forceCoverageMatch: string[];
|
|
53
|
+
forceExit: boolean;
|
|
54
|
+
json: boolean;
|
|
55
|
+
globals: import("@jest/types/build/Config").ConfigGlobals;
|
|
56
|
+
globalSetup: string | null | undefined;
|
|
57
|
+
globalTeardown: string | null | undefined;
|
|
58
|
+
haste: import("@jest/types/build/Config").HasteConfig;
|
|
59
|
+
reporters: (string | import("@jest/types/build/Config").ReporterConfig)[];
|
|
60
|
+
logHeapUsage: boolean;
|
|
61
|
+
lastCommit: boolean;
|
|
62
|
+
listTests: boolean;
|
|
63
|
+
mapCoverage: boolean;
|
|
64
|
+
maxConcurrency: number;
|
|
65
|
+
maxWorkers: string | number;
|
|
66
|
+
moduleDirectories: string[];
|
|
67
|
+
moduleFileExtensions: string[];
|
|
68
|
+
moduleLoader: string;
|
|
69
|
+
moduleNameMapper: {
|
|
70
|
+
[key: string]: string | string[];
|
|
71
|
+
};
|
|
72
|
+
modulePathIgnorePatterns: string[];
|
|
73
|
+
modulePaths: string[];
|
|
74
|
+
name: string;
|
|
75
|
+
noStackTrace: boolean;
|
|
76
|
+
notify: boolean;
|
|
77
|
+
notifyMode: string;
|
|
78
|
+
onlyChanged: boolean;
|
|
79
|
+
outputFile: string;
|
|
80
|
+
passWithNoTests: boolean;
|
|
81
|
+
preprocessorIgnorePatterns: string[];
|
|
82
|
+
preset: string | null | undefined;
|
|
83
|
+
prettierPath: string | null | undefined;
|
|
84
|
+
projects: string[];
|
|
85
|
+
replname: string | null | undefined;
|
|
86
|
+
resetMocks: boolean;
|
|
87
|
+
resetModules: boolean;
|
|
88
|
+
resolver: string | null | undefined;
|
|
89
|
+
restoreMocks: boolean;
|
|
90
|
+
rootDir: string;
|
|
91
|
+
roots: string[];
|
|
92
|
+
runner: string;
|
|
93
|
+
runTestsByPath: boolean;
|
|
94
|
+
scriptPreprocessor: string;
|
|
95
|
+
setupFiles: string[];
|
|
96
|
+
setupTestFrameworkScriptFile: string;
|
|
97
|
+
setupFilesAfterEnv: string[];
|
|
98
|
+
silent: boolean;
|
|
99
|
+
skipFilter: boolean;
|
|
100
|
+
skipNodeResolution: boolean;
|
|
101
|
+
snapshotResolver: string;
|
|
102
|
+
snapshotSerializers: string[];
|
|
103
|
+
errorOnDeprecated: boolean;
|
|
104
|
+
testEnvironment: string;
|
|
105
|
+
testEnvironmentOptions: Record<string, any>;
|
|
106
|
+
testFailureExitCode: string | number;
|
|
107
|
+
testLocationInResults: boolean;
|
|
108
|
+
testMatch: string[];
|
|
109
|
+
testNamePattern: string;
|
|
110
|
+
testPathDirs: string[];
|
|
111
|
+
testPathIgnorePatterns: string[];
|
|
112
|
+
testRegex: string | string[];
|
|
113
|
+
testResultsProcessor: string;
|
|
114
|
+
testRunner: string;
|
|
115
|
+
testSequencer: string;
|
|
116
|
+
testURL: string;
|
|
117
|
+
testTimeout: number;
|
|
118
|
+
timers: "real" | "fake";
|
|
119
|
+
transform: {
|
|
120
|
+
[regex: string]: string | import("@jest/types/build/Config").TransformerConfig;
|
|
121
|
+
};
|
|
122
|
+
transformIgnorePatterns: string[];
|
|
123
|
+
watchPathIgnorePatterns: string[];
|
|
124
|
+
unmockedModulePathPatterns: string[];
|
|
125
|
+
updateSnapshot: boolean;
|
|
126
|
+
useStderr: boolean;
|
|
127
|
+
verbose?: boolean | undefined;
|
|
128
|
+
watch: boolean;
|
|
129
|
+
watchAll: boolean;
|
|
130
|
+
watchman: boolean;
|
|
131
|
+
watchPlugins: (string | [string, Record<string, any>])[];
|
|
132
|
+
}>, "moduleFileExtensions" | "testMatch" | "transform">;
|
|
23
133
|
export { jestPreset, };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
21
21
|
};
|
|
22
22
|
var _a;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.jestPreset = exports.__resetModule = exports.__singleton = exports.canInstrument = exports.getCacheKey = exports.process = exports.createTransformer = exports.digest = exports.version = exports.pathsToModuleNameMapper = exports.createJestPreset = exports.mocked = void 0;
|
|
24
25
|
var bs_logger_1 = require("bs-logger");
|
|
25
26
|
var fs_1 = require("fs");
|
|
26
27
|
var path_1 = require("path");
|
|
@@ -20,6 +20,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
20
20
|
return ar;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.factory = exports.version = exports.name = void 0;
|
|
23
24
|
var bs_logger_1 = require("bs-logger");
|
|
24
25
|
var HOIST_METHODS = ['mock', 'unmock', 'enableAutomock', 'disableAutomock', 'deepUnmock'];
|
|
25
26
|
exports.name = 'hoisting-jest-mock';
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.TsJestTransformer = void 0;
|
|
14
15
|
var util_1 = require("util");
|
|
15
16
|
var config_set_1 = require("./config/config-set");
|
|
16
17
|
var constants_1 = require("./constants");
|
|
@@ -35,7 +36,7 @@ var TsJestTransformer = (function () {
|
|
|
35
36
|
get: function () {
|
|
36
37
|
return ++TsJestTransformer._lastTransformerId;
|
|
37
38
|
},
|
|
38
|
-
enumerable:
|
|
39
|
+
enumerable: false,
|
|
39
40
|
configurable: true
|
|
40
41
|
});
|
|
41
42
|
TsJestTransformer.prototype[INSPECT_CUSTOM] = function () {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import * as _babel from 'babel__core';
|
|
1
2
|
import * as _ts from 'typescript';
|
|
3
|
+
export declare type BabelConfig = _babel.TransformOptions;
|
|
2
4
|
export interface TsJestGlobalOptions {
|
|
3
5
|
tsConfig?: boolean | string | _ts.CompilerOptions;
|
|
4
6
|
tsconfig?: boolean | string | _ts.CompilerOptions;
|
|
5
|
-
packageJson?: boolean | string |
|
|
7
|
+
packageJson?: boolean | string | Record<string, unknown>;
|
|
6
8
|
isolatedModules?: boolean;
|
|
7
9
|
compiler?: string;
|
|
8
10
|
astTransformers?: string[];
|
package/dist/util/backports.js
CHANGED
|
@@ -12,6 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
var _a;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.backportTsJestDebugEnvVar = exports.backportJestConfig = void 0;
|
|
15
16
|
var bs_logger_1 = require("bs-logger");
|
|
16
17
|
var messages_1 = require("./messages");
|
|
17
18
|
var context = (_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'backports', _a);
|
package/dist/util/exported.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var testing_1 = require("./testing");
|
|
4
|
-
exports
|
|
4
|
+
Object.defineProperty(exports, "mocked", { enumerable: true, get: function () { return testing_1.mocked; } });
|
|
5
5
|
var create_jest_preset_1 = require("../config/create-jest-preset");
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "createJestPreset", { enumerable: true, get: function () { return create_jest_preset_1.createJestPreset; } });
|
|
7
7
|
var paths_to_module_name_mapper_1 = require("../config/paths-to-module-name-mapper");
|
|
8
|
-
exports
|
|
8
|
+
Object.defineProperty(exports, "pathsToModuleNameMapper", { enumerable: true, get: function () { return paths_to_module_name_mapper_1.pathsToModuleNameMapper; } });
|
package/dist/util/importer.js
CHANGED
|
@@ -37,6 +37,7 @@ var __spread = (this && this.__spread) || function () {
|
|
|
37
37
|
return ar;
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.__requireModule = exports.importer = exports.Importer = void 0;
|
|
40
41
|
var logger_1 = require("./logger");
|
|
41
42
|
var memoize_1 = require("./memoize");
|
|
42
43
|
var messages_1 = require("./messages");
|
|
@@ -61,7 +62,7 @@ var Importer = (function () {
|
|
|
61
62
|
jest: [passThru(version_checkers_1.VersionCheckers.jest.warn)],
|
|
62
63
|
});
|
|
63
64
|
},
|
|
64
|
-
enumerable:
|
|
65
|
+
enumerable: false,
|
|
65
66
|
configurable: true
|
|
66
67
|
});
|
|
67
68
|
Importer.prototype.babelJest = function (why) {
|
package/dist/util/json.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonableValue = void 0;
|
|
3
4
|
var json_1 = require("./json");
|
|
4
5
|
var JsonableValue = (function () {
|
|
5
6
|
function JsonableValue(value) {
|
|
@@ -13,14 +14,14 @@ var JsonableValue = (function () {
|
|
|
13
14
|
this._value = value;
|
|
14
15
|
this._serialized = json_1.stringify(value);
|
|
15
16
|
},
|
|
16
|
-
enumerable:
|
|
17
|
+
enumerable: false,
|
|
17
18
|
configurable: true
|
|
18
19
|
});
|
|
19
20
|
Object.defineProperty(JsonableValue.prototype, "serialized", {
|
|
20
21
|
get: function () {
|
|
21
22
|
return this._serialized;
|
|
22
23
|
},
|
|
23
|
-
enumerable:
|
|
24
|
+
enumerable: false,
|
|
24
25
|
configurable: true
|
|
25
26
|
});
|
|
26
27
|
JsonableValue.prototype.valueOf = function () {
|
package/dist/util/logger.js
CHANGED
package/dist/util/memoize.js
CHANGED
package/dist/util/messages.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interpolate = void 0;
|
|
3
4
|
function interpolate(msg, vars) {
|
|
4
5
|
if (vars === void 0) { vars = {}; }
|
|
5
6
|
return msg.replace(/\{\{([^\}]+)\}\}/g, function (_, key) { return (key in vars ? vars[key] : _); });
|
package/dist/util/sha1.js
CHANGED
package/dist/util/testing.js
CHANGED
package/dist/util/ts-error.js
CHANGED
|
@@ -13,6 +13,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
};
|
|
14
14
|
})();
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TSError = exports.INSPECT_CUSTOM = void 0;
|
|
16
17
|
var make_error_1 = require("make-error");
|
|
17
18
|
var util_1 = require("util");
|
|
18
19
|
var logger_1 = require("./logger");
|
package/jest-base.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": "cli.js",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@commitlint/cli": "8.x",
|
|
84
84
|
"@commitlint/config-conventional": "8.x",
|
|
85
|
-
"@jest/transform": "
|
|
86
|
-
"@jest/types": "
|
|
85
|
+
"@jest/transform": "26.x",
|
|
86
|
+
"@jest/types": "26.x",
|
|
87
87
|
"@types/babel__core": "7.x",
|
|
88
88
|
"@types/buffer-from": "latest",
|
|
89
89
|
"@types/cross-spawn": "latest",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@typescript-eslint/parser": "latest",
|
|
106
106
|
"conventional-changelog-cli": "2.x",
|
|
107
107
|
"cross-spawn": "latest",
|
|
108
|
-
"eslint": "
|
|
108
|
+
"eslint": "7.x",
|
|
109
109
|
"eslint-config-prettier": "latest",
|
|
110
110
|
"eslint-plugin-jest": "latest",
|
|
111
111
|
"eslint-plugin-jsdoc": "latest",
|
|
@@ -124,11 +124,7 @@
|
|
|
124
124
|
"typescript": "3.x"
|
|
125
125
|
},
|
|
126
126
|
"lint-staged": {
|
|
127
|
-
"*.{ts,tsx}": [
|
|
128
|
-
"eslint --fix",
|
|
129
|
-
"git add"
|
|
130
|
-
],
|
|
131
|
-
"*.{js,jsx}": [
|
|
127
|
+
"*.{ts,tsx,js,jsx}": [
|
|
132
128
|
"eslint --fix",
|
|
133
129
|
"git add"
|
|
134
130
|
]
|