ts-jest 26.5.1 → 26.5.2

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
- ce4f21820adc1fe82ffa3a6379b75d5e66b7b8f1
1
+ f05021154752d867f897fb08a2c5739108a4251c
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **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)
7
+ * **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)
8
+ * **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))
9
+ * **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)
10
+
11
+
12
+
1
13
  ## [26.5.1](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.5.1) (2021-02-09)
2
14
 
3
15
 
@@ -73,6 +73,7 @@ var fs_1 = require("fs");
73
73
  var path_1 = require("path");
74
74
  var memoize = require("lodash/memoize");
75
75
  var mkdirp = require("mkdirp");
76
+ var config_set_1 = require("../config/config-set");
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,7 @@ 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
+ throw new Error(messages_1.interpolate("Unable to process '{{file}}'. Please make sure that `outDir` in your tsconfig is neither `''` or `'.'`.", { file: fileName }));
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,6 +2,7 @@ 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
7
  private readonly jestConfig;
7
8
  private readonly parentLogger?;
@@ -15,7 +16,7 @@ export declare class ConfigSet {
15
16
  readonly rootDir: string;
16
17
  protected _overriddenCompilerOptions: Partial<CompilerOptions>;
17
18
  constructor(jestConfig: Config.ProjectConfig, parentLogger?: Logger | undefined);
18
- protected _resolveTsConfig(compilerOptions?: CompilerOptions, resolvedConfigFile?: string): Record<string, any>;
19
+ protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): Record<string, any>;
19
20
  get tsJestDigest(): string;
20
21
  isTestFile(fileName: string): boolean;
21
22
  shouldStringifyContent(filePath: string): boolean;
@@ -149,8 +149,6 @@ var ConfigSet = (function () {
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
151
  this._backportJestCfg();
152
- this._setupTsJestCfg(options);
153
- this._resolveTsCacheDir();
154
152
  this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
155
153
  return pattern instanceof RegExp || typeof pattern === 'string';
156
154
  });
@@ -158,6 +156,8 @@ var ConfigSet = (function () {
158
156
  (_b = this._matchablePatterns).push.apply(_b, __spread(constants_1.DEFAULT_JEST_TEST_MATCH));
159
157
  }
160
158
  this._matchTestFilePath = jest_util_1.globsToMatcher(this._matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; }));
159
+ this._setupTsJestCfg(options);
160
+ this._resolveTsCacheDir();
161
161
  }
162
162
  ConfigSet.prototype._backportJestCfg = function () {
163
163
  var config = backports_1.backportJestConfig(this.logger, this.jestConfig);
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "26.5.1",
3
+ "version": "26.5.2",
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",
@@ -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",