ts-jest 26.5.2 → 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
- f05021154752d867f897fb08a2c5739108a4251c
1
+ 0788d22a41e10783adc30ba2842a75509b3e3a1c
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
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
+
1
12
  ## [26.5.2](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) (2021-02-21)
2
13
 
3
14
 
@@ -267,7 +267,8 @@ exports.initializeLanguageServiceInstance = function (configs, logger) {
267
267
  }
268
268
  }
269
269
  if (output.emitSkipped) {
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
+ 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, '{}'];
271
272
  }
272
273
  if (!output.outputFiles.length) {
273
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}}`.", {
@@ -4,7 +4,6 @@ import { CompilerOptions, CustomTransformers, Diagnostic, ParsedCommandLine } fr
4
4
  import type { TTypeScript } from '../types';
5
5
  import type { RawCompilerOptions } from '../tsconfig-raw';
6
6
  export declare class ConfigSet {
7
- private readonly jestConfig;
8
7
  private readonly parentLogger?;
9
8
  readonly logger: Logger;
10
9
  readonly compilerModule: TTypeScript;
@@ -15,7 +14,7 @@ export declare class ConfigSet {
15
14
  customTransformers: CustomTransformers;
16
15
  readonly rootDir: string;
17
16
  protected _overriddenCompilerOptions: Partial<CompilerOptions>;
18
- constructor(jestConfig: Config.ProjectConfig, parentLogger?: Logger | undefined);
17
+ constructor(jestConfig: Config.ProjectConfig | undefined, parentLogger?: Logger | undefined);
19
18
  protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): Record<string, any>;
20
19
  get tsJestDigest(): string;
21
20
  isTestFile(fileName: string): boolean;
@@ -119,7 +119,6 @@ var ConfigSet = (function () {
119
119
  function ConfigSet(jestConfig, parentLogger) {
120
120
  var _a, _b;
121
121
  var _c, _d, _e, _f;
122
- this.jestConfig = jestConfig;
123
122
  this.parentLogger = parentLogger;
124
123
  this.customTransformers = Object.create(null);
125
124
  this._overriddenCompilerOptions = {
@@ -141,14 +140,14 @@ var ConfigSet = (function () {
141
140
  this.logger = this.parentLogger
142
141
  ? this.parentLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'config', _a))
143
142
  : logger_1.rootLogger.child({ namespace: 'config' });
144
- this.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
151
  this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) {
153
152
  return pattern instanceof RegExp || typeof pattern === 'string';
154
153
  });
@@ -159,8 +158,8 @@ var ConfigSet = (function () {
159
158
  this._setupTsJestCfg(options);
160
159
  this._resolveTsCacheDir();
161
160
  }
162
- ConfigSet.prototype._backportJestCfg = function () {
163
- var config = backports_1.backportJestConfig(this.logger, 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
  };
@@ -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.2",
3
+ "version": "26.5.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
@@ -58,7 +58,6 @@
58
58
  },
59
59
  "homepage": "https://kulshekhar.github.io/ts-jest",
60
60
  "dependencies": {
61
- "@types/jest": "26.x",
62
61
  "bs-logger": "0.x",
63
62
  "buffer-from": "1.x",
64
63
  "fast-json-stable-stringify": "2.x",
@@ -90,6 +89,7 @@
90
89
  "@types/buffer-from": "latest",
91
90
  "@types/cross-spawn": "latest",
92
91
  "@types/fs-extra": "latest",
92
+ "@types/jest": "26.x",
93
93
  "@types/js-yaml": "latest",
94
94
  "@types/json5": "latest",
95
95
  "@types/lodash": "4.x",