ts-jest 26.4.4 → 26.5.3

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
- a9a5dc2939780dca25d373663e916519b0ac2dfb
1
+ 0788d22a41e10783adc30ba2842a75509b3e3a1c
package/CHANGELOG.md CHANGED
@@ -1,3 +1,55 @@
1
+ ## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **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)
7
+ * 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)
8
+ * **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)
9
+
10
+
11
+
12
+ ## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **compiler:** exclude files in `outDir` from compiler source files ([#2376](https://github.com/kulshekhar/ts-jest/issues/2376)) ([9034677](https://github.com/kulshekhar/ts-jest/commit/9034677f9ce0968339d3d942a70e888996fac532)), closes [#2350](https://github.com/kulshekhar/ts-jest/issues/2350) [#2374](https://github.com/kulshekhar/ts-jest/issues/2374)
18
+ * **config:** define `matchTestFilePath` before `setupTsJestCfg` ([#2373](https://github.com/kulshekhar/ts-jest/issues/2373)) ([c427fea](https://github.com/kulshekhar/ts-jest/commit/c427fea48a24b5ce6e8b9260d3c322583b062a77)), closes [#2371](https://github.com/kulshekhar/ts-jest/issues/2371)
19
+ * **config:** improve emit skipped error message and ensure `outDir` always `TS_JEST_OUT_DIR` ([#2357](https://github.com/kulshekhar/ts-jest/issues/2357)) ([f2808bb](https://github.com/kulshekhar/ts-jest/commit/f2808bb0b15231c67ccb9a97ed606741213c03e6))
20
+ * **typings:** set correct typing for `tsconfig`/`tsConfig` option ([#2377](https://github.com/kulshekhar/ts-jest/issues/2377)) ([d4f6aff](https://github.com/kulshekhar/ts-jest/commit/d4f6aff3f181761bf25c64ff1a97dd19a69196f9)), closes [#2368](https://github.com/kulshekhar/ts-jest/issues/2368)
21
+
22
+
23
+
24
+ ## [26.5.1](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.5.1) (2021-02-09)
25
+
26
+
27
+ ### Features
28
+
29
+ * **config:** support typed config options for jest config typescript ([#2336](https://github.com/kulshekhar/ts-jest/issues/2336)) ([f4f5d32](https://github.com/kulshekhar/ts-jest/commit/f4f5d3205d1c80e545a32c02c6a66e7e91386f7f))
30
+ * **presets:** add typing for `presets` entry point ([#2341](https://github.com/kulshekhar/ts-jest/issues/2341)) ([e12b004](https://github.com/kulshekhar/ts-jest/commit/e12b004dcc5848d5ae0638e885147c54e11cc72b)), closes [#2325](https://github.com/kulshekhar/ts-jest/issues/2325)
31
+
32
+
33
+
34
+ # [26.5.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.4.4) (2021-01-29)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * reduce size of `node_modules` when adding `ts-jest` ([#2309](https://github.com/kulshekhar/ts-jest/issues/2309)) ([6bf2e8a](https://github.com/kulshekhar/ts-jest/commit/b8d5d2090567f23947d9efd87f5f869b16bf2e8a))
40
+
41
+
42
+ ### Features
43
+
44
+ * introduce `exclude` to exclude files from diagnostics ([#2308](https://github.com/kulshekhar/ts-jest/issues/2308)) ([cd82fd3](https://github.com/kulshekhar/ts-jest/commit/0c555c250774a7fd9e356cf20a3d8b693cd82fd3))
45
+
46
+
47
+ ### DEPRECATIONS
48
+
49
+ * **config**: deprecate `pathRegex` in favor of `exclude` ([#2308](https://github.com/kulshekhar/ts-jest/issues/2308)) ([cd82fd3](https://github.com/kulshekhar/ts-jest/commit/0c555c250774a7fd9e356cf20a3d8b693cd82fd3))
50
+
51
+
52
+
1
53
  ## [26.4.4](https://github.com/kulshekhar/ts-jest/compare/v26.4.3...v26.4.4) (2020-11-08)
2
54
 
3
55
 
@@ -54,8 +54,9 @@ var path_1 = require("path");
54
54
  var presets_1 = require("../helpers/presets");
55
55
  exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, base, tsJestConf, content;
57
- return __generator(this, function (_b) {
58
- file = args._[0] || 'jest.config.js';
57
+ var _b, _c;
58
+ return __generator(this, function (_d) {
59
+ file = (_c = (_b = args._[0]) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : 'jest.config.js';
59
60
  filePath = path_1.join(process.cwd(), file);
60
61
  name = path_1.basename(file);
61
62
  isPackage = name === 'package.json';
@@ -66,9 +66,10 @@ var backports_1 = require("../../utils/backports");
66
66
  var presets_1 = require("../helpers/presets");
67
67
  exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
68
68
  var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix;
69
- return __generator(this, function (_a) {
69
+ var _a;
70
+ return __generator(this, function (_b) {
70
71
  nullLogger = bs_logger_1.createLogger({ targets: [] });
71
- file = args._[0];
72
+ file = (_a = args._[0]) === null || _a === void 0 ? void 0 : _a.toString();
72
73
  filePath = path_1.resolve(process.cwd(), file);
73
74
  footNotes = [];
74
75
  if (!fs_1.existsSync(filePath)) {
@@ -71,8 +71,9 @@ exports.initializeLanguageServiceInstance = void 0;
71
71
  var bs_logger_1 = require("bs-logger");
72
72
  var fs_1 = require("fs");
73
73
  var path_1 = require("path");
74
- var memoize = require("lodash.memoize");
74
+ var memoize = require("lodash/memoize");
75
75
  var mkdirp = require("mkdirp");
76
+ var config_set_1 = require("../config/config-set");
76
77
  var constants_1 = require("../constants");
77
78
  var messages_1 = require("../utils/messages");
78
79
  var json_1 = require("../utils/json");
@@ -113,7 +114,7 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
113
114
  catch (e) { }
114
115
  }
115
116
  configs.parsedTsConfig.fileNames
116
- .filter(function (fileName) { return !configs.isTestFile(fileName); })
117
+ .filter(function (fileName) { var _a; return !configs.isTestFile(fileName) && !fileName.includes((_a = configs.parsedTsConfig.options.outDir) !== null && _a !== void 0 ? _a : config_set_1.TS_JEST_OUT_DIR); })
117
118
  .forEach(function (fileName) {
118
119
  memoryCache.files.set(fileName, {
119
120
  version: 0,
@@ -266,7 +267,8 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
266
267
  }
267
268
  }
268
269
  if (output.emitSkipped) {
269
- throw new TypeError(path_1.relative(cwd, fileName) + ": Emit skipped for language service");
270
+ logger.warn(messages_1.interpolate("Unable to process '{{file}}', falling back to original file content. Please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation", { file: fileName }));
271
+ return [code, '{}'];
270
272
  }
271
273
  if (!output.outputFiles.length) {
272
274
  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}}`.", {
@@ -2,7 +2,9 @@ import type { Config } from '@jest/types';
2
2
  import { Logger } from 'bs-logger';
3
3
  import { CompilerOptions, CustomTransformers, Diagnostic, ParsedCommandLine } from 'typescript';
4
4
  import type { TTypeScript } from '../types';
5
+ import type { RawCompilerOptions } from '../tsconfig-raw';
5
6
  export declare class ConfigSet {
7
+ private readonly parentLogger?;
6
8
  readonly logger: Logger;
7
9
  readonly compilerModule: TTypeScript;
8
10
  readonly isolatedModules: boolean;
@@ -12,10 +14,10 @@ export declare class ConfigSet {
12
14
  customTransformers: CustomTransformers;
13
15
  readonly rootDir: string;
14
16
  protected _overriddenCompilerOptions: Partial<CompilerOptions>;
15
- constructor(jestConfig: Config.ProjectConfig, parentLogger?: Logger | undefined);
16
- protected _resolveTsConfig(compilerOptions?: CompilerOptions, resolvedConfigFile?: string): Record<string, any>;
17
+ constructor(jestConfig: Config.ProjectConfig | undefined, parentLogger?: Logger | undefined);
18
+ protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): Record<string, any>;
17
19
  get tsJestDigest(): string;
18
- get isTestFile(): (fileName: string) => boolean;
20
+ isTestFile(fileName: string): boolean;
19
21
  shouldStringifyContent(filePath: string): boolean;
20
22
  raiseDiagnostics(diagnostics: Diagnostic[], filePath?: string, logger?: Logger): void;
21
23
  shouldReportDiagnostics(filePath: string): boolean;
@@ -117,9 +117,8 @@ var toDiagnosticCodeList = function (items, into) {
117
117
  };
118
118
  var ConfigSet = (function () {
119
119
  function ConfigSet(jestConfig, parentLogger) {
120
- var _a;
121
- var _b, _c, _d, _e;
122
- this.jestConfig = jestConfig;
120
+ var _a, _b;
121
+ var _c, _d, _e, _f;
123
122
  this.parentLogger = parentLogger;
124
123
  this.customTransformers = Object.create(null);
125
124
  this._overriddenCompilerOptions = {
@@ -141,25 +140,32 @@ 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.cwd = path_1.normalize((_b = this.jestConfig.cwd) !== null && _b !== void 0 ? _b : process.cwd());
145
- this.rootDir = path_1.normalize((_c = this.jestConfig.rootDir) !== null && _c !== void 0 ? _c : this.cwd);
146
- var tsJestCfg = this.jestConfig.globals && this.jestConfig.globals['ts-jest'];
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
- this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", (_d = options.compiler) !== null && _d !== void 0 ? _d : 'typescript');
149
- this.isolatedModules = (_e = options.isolatedModules) !== null && _e !== void 0 ? _e : false;
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
+ 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();
151
+ this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
152
+ return pattern instanceof RegExp || typeof pattern === 'string';
153
+ });
154
+ if (!this._matchablePatterns.length) {
155
+ (_b = this._matchablePatterns).push.apply(_b, __spread(constants_1.DEFAULT_JEST_TEST_MATCH));
156
+ }
157
+ this._matchTestFilePath = jest_util_1.globsToMatcher(this._matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; }));
152
158
  this._setupTsJestCfg(options);
153
159
  this._resolveTsCacheDir();
154
160
  }
155
- ConfigSet.prototype._backportJestCfg = function () {
156
- var config = backports_1.backportJestConfig(this.logger, this.jestConfig);
161
+ ConfigSet.prototype._backportJestCfg = function (jestCfg) {
162
+ var config = backports_1.backportJestConfig(this.logger, jestCfg);
157
163
  this.logger.debug({ jestConfig: config }, 'normalized jest config');
158
164
  this._jestCfg = config;
159
165
  };
160
166
  ConfigSet.prototype._setupTsJestCfg = function (options) {
161
167
  var _this = this;
162
- var _a, _b, _c;
168
+ var _a, _b, _c, _d;
163
169
  if (options.packageJson) {
164
170
  this.logger.warn("The option `packageJson` is deprecated and will be removed in ts-jest 27. This option is not used by internal `ts-jest`");
165
171
  }
@@ -203,23 +209,36 @@ var ConfigSet = (function () {
203
209
  }
204
210
  this._diagnostics = {
205
211
  pretty: (_b = diagnosticsOpt.pretty) !== null && _b !== void 0 ? _b : true,
212
+ exclude: (_c = diagnosticsOpt.exclude) !== null && _c !== void 0 ? _c : [],
206
213
  ignoreCodes: toDiagnosticCodeList(ignoreList),
207
- pathRegex: normalizeRegex(diagnosticsOpt.pathRegex),
208
214
  throws: !diagnosticsOpt.warnOnly,
209
215
  };
216
+ if (diagnosticsOpt.pathRegex) {
217
+ this.logger.warn("The option `pathRegex` is deprecated and will be removed in ts-jest 27, use `exclude` instead");
218
+ this._diagnostics = __assign(__assign({}, this._diagnostics), { pathRegex: normalizeRegex(diagnosticsOpt.pathRegex) });
219
+ }
210
220
  }
211
221
  else {
212
222
  this._diagnostics = {
213
223
  ignoreCodes: diagnosticsOpt ? toDiagnosticCodeList(ignoreList) : [],
224
+ exclude: [],
214
225
  pretty: true,
215
226
  throws: diagnosticsOpt,
216
227
  };
217
228
  }
229
+ if (this._diagnostics.pathRegex && !this._diagnostics.exclude.length) {
230
+ this._shouldGetDiagnosticsForFile = new RegExp(this._diagnostics.pathRegex);
231
+ }
232
+ else {
233
+ this._shouldGetDiagnosticsForFile = this._diagnostics.exclude.length
234
+ ? jest_util_1.globsToMatcher(this._diagnostics.exclude)
235
+ : function () { return true; };
236
+ }
218
237
  this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option');
219
238
  if (options.tsConfig) {
220
239
  this.logger.warn("The option `tsConfig` is deprecated and will be removed in ts-jest 27, use `tsconfig` instead");
221
240
  }
222
- var tsconfigOpt = (_c = options.tsConfig) !== null && _c !== void 0 ? _c : options.tsconfig;
241
+ var tsconfigOpt = (_d = options.tsConfig) !== null && _d !== void 0 ? _d : options.tsconfig;
223
242
  var configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined;
224
243
  this.parsedTsConfig = this._resolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath);
225
244
  this.raiseDiagnostics(this.parsedTsConfig.errors, configFilePath);
@@ -411,23 +430,12 @@ var ConfigSet = (function () {
411
430
  enumerable: false,
412
431
  configurable: true
413
432
  });
414
- Object.defineProperty(ConfigSet.prototype, "isTestFile", {
415
- get: function () {
416
- var matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
417
- return pattern instanceof RegExp || typeof pattern === 'string';
418
- });
419
- if (!matchablePatterns.length) {
420
- matchablePatterns.push.apply(matchablePatterns, __spread(constants_1.DEFAULT_JEST_TEST_MATCH));
421
- }
422
- var stringPatterns = matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; });
423
- var isMatch = jest_util_1.globsToMatcher(stringPatterns);
424
- return function (fileName) {
425
- return matchablePatterns.some(function (pattern) { return (typeof pattern === 'string' ? isMatch(fileName) : pattern.test(fileName)); });
426
- };
427
- },
428
- enumerable: false,
429
- configurable: true
430
- });
433
+ ConfigSet.prototype.isTestFile = function (fileName) {
434
+ var _this = this;
435
+ return this._matchablePatterns.some(function (pattern) {
436
+ return typeof pattern === 'string' ? _this._matchTestFilePath(fileName) : pattern.test(fileName);
437
+ });
438
+ };
431
439
  ConfigSet.prototype.shouldStringifyContent = function (filePath) {
432
440
  return this._stringifyContentRegExp ? this._stringifyContentRegExp.test(filePath) : false;
433
441
  };
@@ -454,14 +462,9 @@ var ConfigSet = (function () {
454
462
  logger ? logger.warn({ error: error }, error.message) : this.logger.warn({ error: error }, error.message);
455
463
  };
456
464
  ConfigSet.prototype.shouldReportDiagnostics = function (filePath) {
457
- var pathRegex = this._diagnostics.pathRegex;
458
- if (pathRegex) {
459
- var regex = new RegExp(pathRegex);
460
- return regex.test(filePath);
461
- }
462
- else {
463
- return true;
464
- }
465
+ return this._shouldGetDiagnosticsForFile instanceof RegExp
466
+ ? this._shouldGetDiagnosticsForFile.test(filePath)
467
+ : this._shouldGetDiagnosticsForFile(filePath);
465
468
  };
466
469
  ConfigSet.prototype._createTsError = function (diagnostics) {
467
470
  var _this = this;
@@ -518,9 +521,6 @@ var ConfigSet = (function () {
518
521
  __decorate([
519
522
  memoize_1.Memoize()
520
523
  ], ConfigSet.prototype, "hooks", null);
521
- __decorate([
522
- memoize_1.Memoize()
523
- ], ConfigSet.prototype, "isTestFile", null);
524
524
  return ConfigSet;
525
525
  }());
526
526
  exports.ConfigSet = ConfigSet;
@@ -1,5 +1,5 @@
1
1
  import type { Config } from '@jest/types';
2
- export declare type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>;
2
+ import type { TsJestPresets } from '../types';
3
3
  interface CreateJestPresetOptions {
4
4
  allowJs?: boolean;
5
5
  }
@@ -0,0 +1,105 @@
1
+ export interface RawCompilerOptions {
2
+ charset?: string;
3
+ composite?: boolean;
4
+ declaration?: boolean;
5
+ declarationDir?: string | null;
6
+ diagnostics?: boolean;
7
+ disableReferencedProjectLoad?: boolean;
8
+ emitBOM?: boolean;
9
+ emitDeclarationOnly?: boolean;
10
+ incremental?: boolean;
11
+ tsBuildInfoFile?: string;
12
+ inlineSourceMap?: boolean;
13
+ inlineSources?: boolean;
14
+ jsx?: 'preserve' | 'react' | 'react-jsx' | 'react-jsxdev' | 'react-native';
15
+ reactNamespace?: string;
16
+ jsxFactory?: string;
17
+ jsxFragmentFactory?: string;
18
+ jsxImportSource?: string;
19
+ listFiles?: boolean;
20
+ mapRoot?: string;
21
+ module?: 'CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | string;
22
+ moduleResolution?: 'Classic' | 'Node';
23
+ newLine?: 'crlf' | 'lf';
24
+ noEmit?: boolean;
25
+ noEmitHelpers?: boolean;
26
+ noEmitOnError?: boolean;
27
+ noImplicitAny?: boolean;
28
+ noImplicitThis?: boolean;
29
+ noUnusedLocals?: boolean;
30
+ noUnusedParameters?: boolean;
31
+ noLib?: boolean;
32
+ noResolve?: boolean;
33
+ noStrictGenericChecks?: boolean;
34
+ skipDefaultLibCheck?: boolean;
35
+ skipLibCheck?: boolean;
36
+ outFile?: string;
37
+ outDir?: string;
38
+ preserveConstEnums?: boolean;
39
+ preserveSymlinks?: boolean;
40
+ preserveWatchOutput?: boolean;
41
+ pretty?: boolean;
42
+ removeComments?: boolean;
43
+ rootDir?: string;
44
+ isolatedModules?: boolean;
45
+ sourceMap?: boolean;
46
+ sourceRoot?: string;
47
+ suppressExcessPropertyErrors?: boolean;
48
+ suppressImplicitAnyIndexErrors?: boolean;
49
+ target?: 'ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ESNext' | string;
50
+ watch?: boolean;
51
+ fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling';
52
+ watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling';
53
+ watchFile?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'useFsEvents' | 'useFsEventsOnParentDirectory';
54
+ experimentalDecorators?: boolean;
55
+ emitDecoratorMetadata?: boolean;
56
+ allowUnusedLabels?: boolean;
57
+ noImplicitReturns?: boolean;
58
+ noUncheckedIndexedAccess?: boolean;
59
+ noFallthroughCasesInSwitch?: boolean;
60
+ allowUnreachableCode?: boolean;
61
+ forceConsistentCasingInFileNames?: boolean;
62
+ generateCpuProfile?: string;
63
+ baseUrl?: string;
64
+ paths?: {
65
+ [k: string]: string[];
66
+ };
67
+ plugins?: {
68
+ name?: string;
69
+ [k: string]: unknown;
70
+ }[];
71
+ rootDirs?: string[];
72
+ typeRoots?: string[];
73
+ types?: string[];
74
+ traceResolution?: boolean;
75
+ allowJs?: boolean;
76
+ noErrorTruncation?: boolean;
77
+ allowSyntheticDefaultImports?: boolean;
78
+ noImplicitUseStrict?: boolean;
79
+ listEmittedFiles?: boolean;
80
+ disableSizeLimit?: boolean;
81
+ lib?: ('ES5' | 'ES6' | 'ES2015' | 'ES2015.Collection' | 'ES2015.Core' | 'ES2015.Generator' | 'ES2015.Iterable' | 'ES2015.Promise' | 'ES2015.Proxy' | 'ES2015.Reflect' | 'ES2015.Symbol.WellKnown' | 'ES2015.Symbol' | 'ES2016' | 'ES2016.Array.Include' | 'ES2017' | 'ES2017.Intl' | 'ES2017.Object' | 'ES2017.SharedMemory' | 'ES2017.String' | 'ES2017.TypedArrays' | 'ES2018' | 'ES2018.AsyncGenerator' | 'ES2018.AsyncIterable' | 'ES2018.Intl' | 'ES2018.Promise' | 'ES2018.Regexp' | 'ES2019' | 'ES2019.Array' | 'ES2019.Object' | 'ES2019.String' | 'ES2019.Symbol' | 'ES2020' | 'ES2020.BigInt' | 'ES2020.Promise' | 'ES2020.String' | 'ES2020.Symbol.WellKnown' | 'ESNext' | 'ESNext.Array' | 'ESNext.AsyncIterable' | 'ESNext.BigInt' | 'ESNext.Intl' | 'ESNext.Promise' | 'ESNext.String' | 'ESNext.Symbol' | 'DOM' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.ImportScripts')[];
82
+ strictNullChecks?: boolean;
83
+ maxNodeModuleJsDepth?: number;
84
+ importHelpers?: boolean;
85
+ importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
86
+ alwaysStrict?: boolean;
87
+ strict?: boolean;
88
+ strictBindCallApply?: boolean;
89
+ downlevelIteration?: boolean;
90
+ checkJs?: boolean;
91
+ strictFunctionTypes?: boolean;
92
+ strictPropertyInitialization?: boolean;
93
+ esModuleInterop?: boolean;
94
+ allowUmdGlobalAccess?: boolean;
95
+ keyofStringsOnly?: boolean;
96
+ useDefineForClassFields?: boolean;
97
+ declarationMap?: boolean;
98
+ resolveJsonModule?: boolean;
99
+ assumeChangesOnlyAffectDirectDependencies?: boolean;
100
+ extendedDiagnostics?: boolean;
101
+ listFilesOnly?: boolean;
102
+ disableSourceOfProjectReferenceRedirect?: boolean;
103
+ disableSolutionSearching?: boolean;
104
+ [k: string]: unknown;
105
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import type { Config } from '@jest/types';
1
2
  import type * as _babel from 'babel__core';
2
3
  import type * as _ts from 'typescript';
4
+ import type { RawCompilerOptions } from './tsconfig-raw';
3
5
  export declare type TTypeScript = typeof _ts;
4
6
  export declare type BabelConfig = _babel.TransformOptions;
5
7
  export interface AstTransformer<T = Record<string, unknown>> {
@@ -12,8 +14,8 @@ export interface ConfigCustomTransformer {
12
14
  afterDeclarations?: (string | AstTransformer)[];
13
15
  }
14
16
  export interface TsJestGlobalOptions {
15
- tsConfig?: boolean | string | _ts.CompilerOptions;
16
- tsconfig?: boolean | string | _ts.CompilerOptions;
17
+ tsConfig?: boolean | string | RawCompilerOptions;
18
+ tsconfig?: boolean | string | RawCompilerOptions;
17
19
  packageJson?: boolean | string | Record<string, unknown>;
18
20
  isolatedModules?: boolean;
19
21
  compiler?: string;
@@ -22,15 +24,24 @@ export interface TsJestGlobalOptions {
22
24
  pretty?: boolean;
23
25
  ignoreCodes?: number | string | (number | string)[];
24
26
  pathRegex?: RegExp | string;
27
+ exclude?: Config.Glob[];
25
28
  warnOnly?: boolean;
26
29
  };
27
30
  babelConfig?: boolean | string | BabelConfig;
28
31
  stringifyContentPathRegex?: string | RegExp;
29
32
  }
33
+ export interface GlobalConfigTsJest extends Config.ConfigGlobals {
34
+ 'ts-jest': TsJestGlobalOptions;
35
+ }
36
+ export interface InitialOptionsTsJest extends Config.InitialOptions {
37
+ globals?: GlobalConfigTsJest;
38
+ }
39
+ export declare type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>;
30
40
  export interface TsJestDiagnosticsCfg {
31
41
  pretty: boolean;
32
42
  ignoreCodes: number[];
33
43
  pathRegex?: string | undefined;
44
+ exclude: Config.Glob[];
34
45
  throws: boolean;
35
46
  warnOnly?: boolean;
36
47
  }
@@ -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 _a = (config || {}).globals, globals = _a === void 0 ? {} : _a;
22
- var _b = globals["ts-jest"], tsJest = _b === void 0 ? {} : _b;
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) {
@@ -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.4.4",
3
+ "version": "26.5.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "description": "A preprocessor with source maps support to help use TypeScript with Jest",
10
10
  "scripts": {
11
- "prebuild": "node scripts/clean-dist.js",
11
+ "prebuild": "node scripts/pre-build.js",
12
12
  "build": "tsc -p tsconfig.build.json",
13
13
  "postbuild": "node scripts/post-build.js",
14
14
  "clean": "node scripts/clean.js",
@@ -32,7 +32,8 @@
32
32
  "prepublishOnly": "npm run test",
33
33
  "preversion": "npm run test",
34
34
  "update:e2e": "node scripts/update-e2e-templates.js",
35
- "version": "npm run changelog && git add CHANGELOG.md"
35
+ "version": "npm run changelog && git add CHANGELOG.md",
36
+ "raw-tsconfig-types": "node scripts/tsconfig-raw-types.js"
36
37
  },
37
38
  "repository": {
38
39
  "type": "git",
@@ -57,13 +58,12 @@
57
58
  },
58
59
  "homepage": "https://kulshekhar.github.io/ts-jest",
59
60
  "dependencies": {
60
- "@types/jest": "26.x",
61
61
  "bs-logger": "0.x",
62
62
  "buffer-from": "1.x",
63
63
  "fast-json-stable-stringify": "2.x",
64
64
  "jest-util": "^26.1.0",
65
65
  "json5": "2.x",
66
- "lodash.memoize": "4.x",
66
+ "lodash": "4.x",
67
67
  "make-error": "1.x",
68
68
  "mkdirp": "1.x",
69
69
  "semver": "7.x",
@@ -89,11 +89,10 @@
89
89
  "@types/buffer-from": "latest",
90
90
  "@types/cross-spawn": "latest",
91
91
  "@types/fs-extra": "latest",
92
+ "@types/jest": "26.x",
92
93
  "@types/js-yaml": "latest",
93
94
  "@types/json5": "latest",
94
- "@types/lodash.memoize": "4.x",
95
- "@types/lodash.merge": "4.x",
96
- "@types/lodash.set": "4.x",
95
+ "@types/lodash": "4.x",
97
96
  "@types/micromatch": "4.x",
98
97
  "@types/mkdirp": "latest",
99
98
  "@types/node": "14.x",
@@ -116,9 +115,9 @@
116
115
  "husky": "4.x",
117
116
  "jest": "26.x",
118
117
  "js-yaml": "latest",
118
+ "json-schema-to-typescript": "^10.1.3",
119
119
  "lint-staged": "latest",
120
- "lodash.merge": "4.x",
121
- "lodash.set": "4.x",
120
+ "node-fetch": "^2.6.1",
122
121
  "npm-run-all": "latest",
123
122
  "prettier": "2.x",
124
123
  "source-map": "latest",
@@ -0,0 +1,8 @@
1
+ import type { TsJestPresets } from '../dist/types'
2
+
3
+ declare const _default: {
4
+ defaults: TsJestPresets;
5
+ jsWithTs: TsJestPresets;
6
+ jsWithBabel: TsJestPresets;
7
+ };
8
+ export = _default;