ts-jest 26.5.0 → 26.5.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.
Files changed (48) hide show
  1. package/.ts-jest-digest +1 -1
  2. package/CHANGELOG.md +47 -0
  3. package/dist/compiler/language-service.js +3 -2
  4. package/dist/config/config-set.d.ts +3 -3
  5. package/dist/config/config-set.js +8 -9
  6. package/dist/presets/create-jest-preset.d.ts +1 -1
  7. package/dist/tsconfig-raw.d.ts +105 -0
  8. package/dist/tsconfig-raw.js +2 -0
  9. package/dist/types.d.ts +10 -2
  10. package/dist/utils/backports.js +5 -3
  11. package/dist/utils/logger.d.ts +1 -1
  12. package/package.json +7 -4
  13. package/presets/index.d.ts +8 -0
  14. package/website/.docusaurus/client-modules.js +0 -8
  15. package/website/.docusaurus/codeTranslations.json +0 -1
  16. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-babel-7-or-ts-md-4aa.json +0 -21
  17. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-contributing-md-4d5.json +0 -21
  18. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-contribution-md-416.json +0 -12
  19. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-debugging-md-2bc.json +0 -21
  20. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-e-2-e-testing-md-594.json +0 -17
  21. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-esm-support-md-ff2.json +0 -21
  22. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-installation-md-3b8.json +0 -17
  23. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-md-295.json +0 -21
  24. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-ast-transformers-md-687.json +0 -12
  25. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-babel-config-md-16d.json +0 -12
  26. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-compiler-md-203.json +0 -12
  27. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-diagnostics-md-a47.json +0 -12
  28. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-isolated-modules-md-9c5.json +0 -12
  29. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-md-aeb.json +0 -21
  30. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-stringify-content-path-regex-md-763.json +0 -12
  31. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-tsconfig-md-c3b.json +0 -12
  32. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-options-use-esm-md-f08.json +0 -12
  33. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-paths-mapping-md-7f7.json +0 -21
  34. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-presets-md-02b.json +0 -21
  35. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-processing-md-eab.json +0 -21
  36. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-react-native-md-668.json +0 -21
  37. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-test-helpers-md-bf3.json +0 -21
  38. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-troubleshooting-md-9d9.json +0 -21
  39. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-version-checking-md-21a.json +0 -21
  40. package/website/.docusaurus/docusaurus-plugin-content-docs/default/version-current-metadata-prop-751.json +0 -117
  41. package/website/.docusaurus/docusaurus-plugin-debug/default/docusaurus-debug-all-content-673.json +0 -530
  42. package/website/.docusaurus/docusaurus.config.js +0 -244
  43. package/website/.docusaurus/globalData.json +0 -124
  44. package/website/.docusaurus/i18n.json +0 -7
  45. package/website/.docusaurus/registry.js +0 -36
  46. package/website/.docusaurus/routes.js +0 -171
  47. package/website/.docusaurus/routesChunkNames.json +0 -124
  48. package/website/.docusaurus/site-metadata.json +0 -31
package/.ts-jest-digest CHANGED
@@ -1 +1 @@
1
- 8078ee424534cfcaad85082d51f4cdef2771e231
1
+ efcca87b12004d3912dbf12aca8fa516d965d1c0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## [26.5.4](https://github.com/kulshekhar/ts-jest/compare/v26.5.3...v26.5.4) (2021-03-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **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)
7
+
8
+
9
+
10
+ ## [26.5.3](https://github.com/kulshekhar/ts-jest/compare/v26.5.2...v26.5.3) (2021-03-03)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **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)
16
+ * 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)
17
+ * **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)
18
+
19
+
20
+
21
+ ## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **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)
27
+ * **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)
28
+ * **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))
29
+ * **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)
30
+
31
+
32
+
33
+ ## [26.5.1](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.5.1) (2021-02-09)
34
+
35
+
36
+ ### Features
37
+
38
+ * **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))
39
+ * **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)
40
+
41
+
42
+
1
43
  # [26.5.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.4.4) (2021-01-29)
2
44
 
3
45
 
@@ -11,6 +53,11 @@
11
53
  * 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))
12
54
 
13
55
 
56
+ ### DEPRECATIONS
57
+
58
+ * **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))
59
+
60
+
14
61
 
15
62
  ## [26.4.4](https://github.com/kulshekhar/ts-jest/compare/v26.4.3...v26.4.4) (2020-11-08)
16
63
 
@@ -113,7 +113,7 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
113
113
  catch (e) { }
114
114
  }
115
115
  configs.parsedTsConfig.fileNames
116
- .filter(function (fileName) { return !configs.isTestFile(fileName); })
116
+ .filter(function (fileName) { return constants_1.TS_TSX_REGEX.test(path_1.extname(fileName)) && !configs.isTestFile(fileName); })
117
117
  .forEach(function (fileName) {
118
118
  memoryCache.files.set(fileName, {
119
119
  version: 0,
@@ -266,7 +266,8 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
266
266
  }
267
267
  }
268
268
  if (output.emitSkipped) {
269
- throw new TypeError(path_1.relative(cwd, fileName) + ": Emit skipped for language service");
269
+ 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 }));
270
+ return [code, '{}'];
270
271
  }
271
272
  if (!output.outputFiles.length) {
272
273
  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,8 +2,8 @@ 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 {
6
- private readonly jestConfig;
7
7
  private readonly parentLogger?;
8
8
  readonly logger: Logger;
9
9
  readonly compilerModule: TTypeScript;
@@ -14,8 +14,8 @@ export declare class ConfigSet {
14
14
  customTransformers: CustomTransformers;
15
15
  readonly rootDir: string;
16
16
  protected _overriddenCompilerOptions: Partial<CompilerOptions>;
17
- constructor(jestConfig: Config.ProjectConfig, parentLogger?: Logger | undefined);
18
- 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>;
19
19
  get tsJestDigest(): string;
20
20
  isTestFile(fileName: string): boolean;
21
21
  shouldStringifyContent(filePath: 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,16 +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.cwd = path_1.normalize((_c = this.jestConfig.cwd) !== null && _c !== void 0 ? _c : process.cwd());
145
- this.rootDir = path_1.normalize((_d = this.jestConfig.rootDir) !== null && _d !== void 0 ? _d : 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
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
- this._setupTsJestCfg(options);
153
- this._resolveTsCacheDir();
154
151
  this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
155
152
  return pattern instanceof RegExp || typeof pattern === 'string';
156
153
  });
@@ -158,9 +155,11 @@ var ConfigSet = (function () {
158
155
  (_b = this._matchablePatterns).push.apply(_b, __spread(constants_1.DEFAULT_JEST_TEST_MATCH));
159
156
  }
160
157
  this._matchTestFilePath = jest_util_1.globsToMatcher(this._matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; }));
158
+ this._setupTsJestCfg(options);
159
+ this._resolveTsCacheDir();
161
160
  }
162
- ConfigSet.prototype._backportJestCfg = function () {
163
- var config = backports_1.backportJestConfig(this.logger, this.jestConfig);
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
  };
@@ -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,6 +1,7 @@
1
1
  import type { Config } from '@jest/types';
2
2
  import type * as _babel from 'babel__core';
3
3
  import type * as _ts from 'typescript';
4
+ import type { RawCompilerOptions } from './tsconfig-raw';
4
5
  export declare type TTypeScript = typeof _ts;
5
6
  export declare type BabelConfig = _babel.TransformOptions;
6
7
  export interface AstTransformer<T = Record<string, unknown>> {
@@ -13,8 +14,8 @@ export interface ConfigCustomTransformer {
13
14
  afterDeclarations?: (string | AstTransformer)[];
14
15
  }
15
16
  export interface TsJestGlobalOptions {
16
- tsConfig?: boolean | string | _ts.CompilerOptions;
17
- tsconfig?: boolean | string | _ts.CompilerOptions;
17
+ tsConfig?: boolean | string | RawCompilerOptions;
18
+ tsconfig?: boolean | string | RawCompilerOptions;
18
19
  packageJson?: boolean | string | Record<string, unknown>;
19
20
  isolatedModules?: boolean;
20
21
  compiler?: string;
@@ -29,6 +30,13 @@ export interface TsJestGlobalOptions {
29
30
  babelConfig?: boolean | string | BabelConfig;
30
31
  stringifyContentPathRegex?: string | RegExp;
31
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'>;
32
40
  export interface TsJestDiagnosticsCfg {
33
41
  pretty: boolean;
34
42
  ignoreCodes: number[];
@@ -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.5.0",
3
+ "version": "26.5.4",
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,7 +58,6 @@
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",
@@ -89,6 +89,7 @@
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
95
  "@types/lodash": "4.x",
@@ -114,7 +115,9 @@
114
115
  "husky": "4.x",
115
116
  "jest": "26.x",
116
117
  "js-yaml": "latest",
118
+ "json-schema-to-typescript": "^10.1.3",
117
119
  "lint-staged": "latest",
120
+ "node-fetch": "^2.6.1",
118
121
  "npm-run-all": "latest",
119
122
  "prettier": "2.x",
120
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;
@@ -1,8 +0,0 @@
1
- export default [
2
- require("/Users/ahn/ts-jest/website/node_modules/remark-admonitions/styles/infima.css"),
3
- require("/Users/ahn/ts-jest/website/node_modules/remark-admonitions/styles/infima.css"),
4
- require("/Users/ahn/ts-jest/website/node_modules/remark-admonitions/styles/infima.css"),
5
- require("/Users/ahn/ts-jest/website/node_modules/infima/dist/css/default/default.css"),
6
- require("/Users/ahn/ts-jest/website/node_modules/@docusaurus/theme-classic/lib/prism-include-languages"),
7
- require("/Users/ahn/ts-jest/website/src/css/custom.css"),
8
- ];
@@ -1 +0,0 @@
1
- {}
@@ -1,21 +0,0 @@
1
- {
2
- "unversionedId": "babel7-or-ts",
3
- "id": "babel7-or-ts",
4
- "isDocsHomePage": false,
5
- "title": "Babel7 or TypeScript",
6
- "description": "In Sept. 2018 Babel7 got released with an interesting preset: @babel/preset-typescript.",
7
- "source": "@site/docs/babel7-or-ts.md",
8
- "slug": "/babel7-or-ts",
9
- "permalink": "/ts-jest/docs/babel7-or-ts",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/babel7-or-ts.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Troubleshooting",
15
- "permalink": "/ts-jest/docs/troubleshooting"
16
- },
17
- "next": {
18
- "title": "Migration from <=23.10",
19
- "permalink": "/ts-jest/docs/migration"
20
- }
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "unversionedId": "contributing",
3
- "id": "contributing",
4
- "isDocsHomePage": false,
5
- "title": "Contributing",
6
- "description": "Check our contributing guide",
7
- "source": "@site/docs/contributing.md",
8
- "slug": "/contributing",
9
- "permalink": "/ts-jest/docs/contributing",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/contributing.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Migration from <=23.10",
15
- "permalink": "/ts-jest/docs/migration"
16
- },
17
- "next": {
18
- "title": "Jest flow",
19
- "permalink": "/ts-jest/docs/processing"
20
- }
21
- }
@@ -1,12 +0,0 @@
1
- {
2
- "unversionedId": "contribution",
3
- "id": "contribution",
4
- "isDocsHomePage": false,
5
- "title": "contribution",
6
- "description": "",
7
- "source": "@site/docs/contribution.md",
8
- "slug": "/contribution",
9
- "permalink": "/ts-jest/docs/contribution",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/contribution.md",
11
- "version": "current"
12
- }
@@ -1,21 +0,0 @@
1
- {
2
- "unversionedId": "debugging",
3
- "id": "debugging",
4
- "isDocsHomePage": false,
5
- "title": "Debugging ts-jest",
6
- "description": "You can activate the debug logger by setting the environment variable TSJESTLOG before running tests.",
7
- "source": "@site/docs/debugging.md",
8
- "slug": "/debugging",
9
- "permalink": "/ts-jest/docs/debugging",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/debugging.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Migration from <=23.10",
15
- "permalink": "/ts-jest/docs/migration"
16
- },
17
- "next": {
18
- "title": "Jest flow",
19
- "permalink": "/ts-jest/docs/processing"
20
- }
21
- }
@@ -1,17 +0,0 @@
1
- {
2
- "unversionedId": "e2e-testing",
3
- "id": "e2e-testing",
4
- "isDocsHomePage": false,
5
- "title": "E2E tests flow",
6
- "description": "These are internal technical documents. If you're not a contributor to ts-jest, but simply trying to use the library you'll find nothing of value here",
7
- "source": "@site/docs/e2e-testing.md",
8
- "slug": "/e2e-testing",
9
- "permalink": "/ts-jest/docs/e2e-testing",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/e2e-testing.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Jest flow",
15
- "permalink": "/ts-jest/docs/processing"
16
- }
17
- }
@@ -1,21 +0,0 @@
1
- {
2
- "unversionedId": "esm-support",
3
- "id": "esm-support",
4
- "isDocsHomePage": false,
5
- "title": "ESM Support",
6
- "description": "To use ts-jest with ESM support, you'll first need to check ESM Jest documentation.",
7
- "source": "@site/docs/esm-support.md",
8
- "slug": "/esm-support",
9
- "permalink": "/ts-jest/docs/esm-support",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/esm-support.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Test helpers",
15
- "permalink": "/ts-jest/docs/test-helpers"
16
- },
17
- "next": {
18
- "title": "Using with React Native",
19
- "permalink": "/ts-jest/docs/react-native"
20
- }
21
- }
@@ -1,17 +0,0 @@
1
- {
2
- "unversionedId": "installation",
3
- "id": "installation",
4
- "isDocsHomePage": false,
5
- "title": "Installation",
6
- "description": "ts-jest is a Typescript preprocessor for Jest pre-processor. You'll need both Jest and TypeScript installed inside your project.",
7
- "source": "@site/docs/installation.md",
8
- "slug": "/installation",
9
- "permalink": "/ts-jest/docs/installation",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/installation.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "next": {
14
- "title": "Presets",
15
- "permalink": "/ts-jest/docs/presets"
16
- }
17
- }
@@ -1,21 +0,0 @@
1
- {
2
- "unversionedId": "migration",
3
- "id": "migration",
4
- "isDocsHomePage": false,
5
- "title": "Migration from <=23.10",
6
- "description": "You can use the config:migrate tool of ts-jest CLI if you're coming from an older version to help you migrate your Jest configuration.",
7
- "source": "@site/docs/migration.md",
8
- "slug": "/migration",
9
- "permalink": "/ts-jest/docs/migration",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/migration.md",
11
- "version": "current",
12
- "sidebar": "docs",
13
- "previous": {
14
- "title": "Babel7 or TypeScript",
15
- "permalink": "/ts-jest/docs/babel7-or-ts"
16
- },
17
- "next": {
18
- "title": "Debugging ts-jest",
19
- "permalink": "/ts-jest/docs/debugging"
20
- }
21
- }
@@ -1,12 +0,0 @@
1
- {
2
- "unversionedId": "options/astTransformers",
3
- "id": "options/astTransformers",
4
- "isDocsHomePage": false,
5
- "title": "AST transformers option",
6
- "description": "ts-jest by default does hoisting for a few jest methods via a TypeScript AST transformer. One can also create custom",
7
- "source": "@site/docs/options/astTransformers.md",
8
- "slug": "/options/astTransformers",
9
- "permalink": "/ts-jest/docs/options/astTransformers",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/options/astTransformers.md",
11
- "version": "current"
12
- }
@@ -1,12 +0,0 @@
1
- {
2
- "unversionedId": "options/babelConfig",
3
- "id": "options/babelConfig",
4
- "isDocsHomePage": false,
5
- "title": "Babel Config option",
6
- "description": "ts-jest by default does NOT use Babel. But you may want to use it, especially if your code rely on Babel plugins to make some transformations. ts-jest can call the BabelJest processor once TypeScript has transformed the source into JavaScript.",
7
- "source": "@site/docs/options/babelConfig.md",
8
- "slug": "/options/babelConfig",
9
- "permalink": "/ts-jest/docs/options/babelConfig",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/options/babelConfig.md",
11
- "version": "current"
12
- }
@@ -1,12 +0,0 @@
1
- {
2
- "unversionedId": "options/compiler",
3
- "id": "options/compiler",
4
- "isDocsHomePage": false,
5
- "title": "Compiler option",
6
- "description": "The compiler option allows you to define the compiler to be used. It'll be used to load the NodeJS module holding the TypeScript compiler.",
7
- "source": "@site/docs/options/compiler.md",
8
- "slug": "/options/compiler",
9
- "permalink": "/ts-jest/docs/options/compiler",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/options/compiler.md",
11
- "version": "current"
12
- }
@@ -1,12 +0,0 @@
1
- {
2
- "unversionedId": "options/diagnostics",
3
- "id": "options/diagnostics",
4
- "isDocsHomePage": false,
5
- "title": "Diagnostics option",
6
- "description": "The diagnostics option configures error reporting.",
7
- "source": "@site/docs/options/diagnostics.md",
8
- "slug": "/options/diagnostics",
9
- "permalink": "/ts-jest/docs/options/diagnostics",
10
- "editUrl": "https://github.com/kulshekhar/ts-jest/edit/master/docs/docs/options/diagnostics.md",
11
- "version": "current"
12
- }