ts-jest 27.0.1 → 27.0.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
- ca007d0ed5f95b54e87f204bbcb1a8a005bab7fc
1
+ 379ec6d53df43eff4f1a882c7005e069f36949a1
package/CHANGELOG.md CHANGED
@@ -1,11 +1,10 @@
1
- ## [27.0.1](https://github.com/kulshekhar/ts-jest/compare/v27.0.0...v27.0.1) (2021-05-26)
1
+ ## [27.0.2](https://github.com/kulshekhar/ts-jest/compare/v27.0.1...v27.0.2) (2021-05-30)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **cli:** keep `testMatch` if old jest config contains it ([#2618](https://github.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://github.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#2616](https://github.com/kulshekhar/ts-jest/issues/2616)
7
- * **compiler:** make sure `isolatedModules: false` use updated compiler options ([#2628](https://github.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://github.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#2629](https://github.com/kulshekhar/ts-jest/issues/2629)
8
- * add missing export `presets` ([#2624](https://github.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://github.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#2623](https://github.com/kulshekhar/ts-jest/issues/2623)
6
+ * **compiler:** add empty string file content to compiler cache ([#2633](https://github.com/kulshekhar/ts-jest/issues/2633)) ([0feb556](https://github.com/kulshekhar/ts-jest/commit/0feb5560a588f87d1d989bf521859fba0fda20fe)), closes [#2625](https://github.com/kulshekhar/ts-jest/issues/2625)
7
+ * **config:** `exclude` should only exclude files which match glob values ([#2637](https://github.com/kulshekhar/ts-jest/issues/2637)) ([c5ce979](https://github.com/kulshekhar/ts-jest/commit/c5ce97902c1b84dc354f270a4f596a6f5f634611)), closes [#2634](https://github.com/kulshekhar/ts-jest/issues/2634)
9
8
 
10
9
 
11
10
 
@@ -15,6 +14,7 @@
15
14
  ### Bug Fixes
16
15
 
17
16
  * **cli:** keep `testMatch` if old jest config contains it ([#2618](https://github.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://github.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#2616](https://github.com/kulshekhar/ts-jest/issues/2616)
17
+ * **compiler:** make sure `isolatedModules: false` use updated compiler options ([#2628](https://github.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://github.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#2629](https://github.com/kulshekhar/ts-jest/issues/2629)
18
18
  * add missing export `presets` ([#2624](https://github.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://github.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#2623](https://github.com/kulshekhar/ts-jest/issues/2623)
19
19
 
20
20
 
@@ -51,7 +51,6 @@ var path_1 = require("path");
51
51
  var bs_logger_1 = require("bs-logger");
52
52
  var memoize_1 = __importDefault(require("lodash/memoize"));
53
53
  var constants_1 = require("../constants");
54
- var json_1 = require("../utils/json");
55
54
  var logger_1 = require("../utils/logger");
56
55
  var messages_1 = require("../utils/messages");
57
56
  var compiler_utils_1 = require("./compiler-utils");
@@ -107,6 +106,7 @@ var TsCompiler = (function () {
107
106
  var moduleKind = this._initialCompilerOptions.module;
108
107
  var esModuleInterop = this._initialCompilerOptions.esModuleInterop;
109
108
  var allowSyntheticDefaultImports = this._initialCompilerOptions.allowSyntheticDefaultImports;
109
+ var currentModuleKind = this._compilerOptions.module;
110
110
  if (options.supportsStaticESM && this.configSet.useESM) {
111
111
  moduleKind =
112
112
  !moduleKind ||
@@ -124,7 +124,7 @@ var TsCompiler = (function () {
124
124
  esModuleInterop: esModuleInterop, module: moduleKind });
125
125
  if (this._languageService) {
126
126
  this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service');
127
- this._updateMemoryCache(fileContent, fileName);
127
+ this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
128
128
  var output = this._languageService.getEmitOutput(fileName);
129
129
  this._doTypeChecking(fileName, options.depGraphs, options.watchMode);
130
130
  if (output.emitSkipped) {
@@ -196,7 +196,7 @@ var TsCompiler = (function () {
196
196
  _this._logger.trace({ normalizedFileName: normalizedFileName, cacheHit: hit }, 'getScriptSnapshot():', 'cache', hit ? 'hit' : 'miss');
197
197
  if (!hit) {
198
198
  var fileContent = (_d = (_b = (_a = _this._fileContentCache.get(normalizedFileName)) !== null && _a !== void 0 ? _a : _this._runtimeCacheFS.get(normalizedFileName)) !== null && _b !== void 0 ? _b : (_c = _this._cachedReadFile) === null || _c === void 0 ? void 0 : _c.call(_this, normalizedFileName)) !== null && _d !== void 0 ? _d : undefined;
199
- if (fileContent) {
199
+ if (fileContent !== undefined) {
200
200
  _this._fileContentCache.set(normalizedFileName, fileContent);
201
201
  _this._fileVersionCache.set(normalizedFileName, 1);
202
202
  }
@@ -253,7 +253,8 @@ var TsCompiler = (function () {
253
253
  this._fileVersionCache.has(fileName) &&
254
254
  this._fileVersionCache.get(fileName) !== 0);
255
255
  };
256
- TsCompiler.prototype._updateMemoryCache = function (contents, fileName) {
256
+ TsCompiler.prototype._updateMemoryCache = function (contents, fileName, isModuleKindTheSame) {
257
+ if (isModuleKindTheSame === void 0) { isModuleKindTheSame = true; }
257
258
  this._logger.debug({ fileName: fileName }, 'updateMemoryCache: update memory cache for language service');
258
259
  var shouldIncrementProjectVersion = false;
259
260
  var hit = this._isFileInCache(fileName);
@@ -269,13 +270,10 @@ var TsCompiler = (function () {
269
270
  this._fileContentCache.set(fileName, contents);
270
271
  shouldIncrementProjectVersion = true;
271
272
  }
272
- if (!this._parsedTsConfig.fileNames.includes(fileName)) {
273
+ if (!this._parsedTsConfig.fileNames.includes(fileName) || !isModuleKindTheSame) {
273
274
  shouldIncrementProjectVersion = true;
274
275
  }
275
276
  }
276
- if (json_1.stringify(this._compilerOptions) !== json_1.stringify(this._initialCompilerOptions)) {
277
- shouldIncrementProjectVersion = true;
278
- }
279
277
  if (shouldIncrementProjectVersion)
280
278
  this._projectVersion++;
281
279
  };
@@ -207,9 +207,9 @@ var ConfigSet = (function () {
207
207
  throws: diagnosticsOpt,
208
208
  };
209
209
  }
210
- this._shouldGetDiagnosticsForFile = this._diagnostics.exclude.length
210
+ this._shouldIgnoreDiagnosticsForFile = this._diagnostics.exclude.length
211
211
  ? jest_util_1.globsToMatcher(this._diagnostics.exclude)
212
- : function () { return true; };
212
+ : function () { return false; };
213
213
  this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option');
214
214
  var tsconfigOpt = options.tsconfig;
215
215
  var configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined;
@@ -397,8 +397,8 @@ var ConfigSet = (function () {
397
397
  ConfigSet.prototype.shouldReportDiagnostics = function (filePath) {
398
398
  var fileExtension = path_1.extname(filePath);
399
399
  return constants_1.JS_JSX_EXTENSIONS.includes(fileExtension)
400
- ? this.parsedTsConfig.options.checkJs && this._shouldGetDiagnosticsForFile(filePath)
401
- : this._shouldGetDiagnosticsForFile(filePath);
400
+ ? this.parsedTsConfig.options.checkJs && !this._shouldIgnoreDiagnosticsForFile(filePath)
401
+ : !this._shouldIgnoreDiagnosticsForFile(filePath);
402
402
  };
403
403
  ConfigSet.prototype._createTsError = function (diagnostics) {
404
404
  var _this = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "27.0.1",
3
+ "version": "27.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -119,6 +119,7 @@
119
119
  "eslint-plugin-prettier": "latest",
120
120
  "execa": "latest",
121
121
  "fs-extra": "10.x",
122
+ "glob": "^7.1.7",
122
123
  "glob-gitignore": "latest",
123
124
  "husky": "4.x",
124
125
  "jest": "^27.0.0",