Comparing version 29.2.0 to 29.2.1
@@ -24,2 +24,3 @@ import { Logger } from 'bs-logger'; | ||
getResolvedModules(fileContent: string, fileName: string, runtimeCacheFS: StringMap): string[]; | ||
private fixupCompilerOptionsForModuleKind; | ||
getCompiledOutput(fileContent: string, fileName: string, options: TsJestCompileOptions): CompiledOutput; | ||
@@ -26,0 +27,0 @@ protected _transpileOutput(fileContent: string, fileName: string): TranspileOutput; |
@@ -115,25 +115,27 @@ "use strict"; | ||
}; | ||
TsCompiler.prototype.fixupCompilerOptionsForModuleKind = function (compilerOptions, isEsm) { | ||
var _a, _b; | ||
if (!isEsm) { | ||
var moduleKind_1 = (_a = compilerOptions.module) !== null && _a !== void 0 ? _a : this._ts.ModuleKind.CommonJS; | ||
var moduleKindValue = [ | ||
this._ts.ModuleKind.CommonJS, | ||
this._ts.ModuleKind.Node16, | ||
this._ts.ModuleKind.NodeNext, | ||
].includes(moduleKind_1) | ||
? moduleKind_1 | ||
: this._ts.ModuleKind.CommonJS; | ||
return __assign(__assign({}, compilerOptions), { module: moduleKindValue }); | ||
} | ||
var moduleKind = (_b = compilerOptions.module) !== null && _b !== void 0 ? _b : this._ts.ModuleKind.ESNext; | ||
var esModuleInterop = [this._ts.ModuleKind.Node16, this._ts.ModuleKind.NodeNext].includes(moduleKind) | ||
? true | ||
: compilerOptions.esModuleInterop; | ||
return __assign(__assign({}, compilerOptions), { module: moduleKind, esModuleInterop: esModuleInterop !== null && esModuleInterop !== void 0 ? esModuleInterop : false }); | ||
}; | ||
TsCompiler.prototype.getCompiledOutput = function (fileContent, fileName, options) { | ||
var e_1, _a; | ||
var moduleKind = this._initialCompilerOptions.module; | ||
var esModuleInterop = this._initialCompilerOptions.esModuleInterop; | ||
var allowSyntheticDefaultImports = this._initialCompilerOptions.allowSyntheticDefaultImports; | ||
var currentModuleKind = this._compilerOptions.module; | ||
var isEsmMode = this.configSet.useESM && options.supportsStaticESM; | ||
if ((this.configSet.babelJestTransformer || (!this.configSet.babelJestTransformer && options.supportsStaticESM)) && | ||
this.configSet.useESM) { | ||
moduleKind = | ||
!moduleKind || | ||
(moduleKind && | ||
![this._ts.ModuleKind.ES2015, this._ts.ModuleKind.ES2020, this._ts.ModuleKind.ESNext].includes(moduleKind)) | ||
? this._ts.ModuleKind.ESNext | ||
: moduleKind; | ||
// Make sure `esModuleInterop` and `allowSyntheticDefaultImports` true to support import CJS into ESM | ||
esModuleInterop = true; | ||
allowSyntheticDefaultImports = true; | ||
} | ||
else { | ||
moduleKind = this._ts.ModuleKind.CommonJS; | ||
} | ||
this._compilerOptions = __assign(__assign({}, this._compilerOptions), { allowSyntheticDefaultImports: allowSyntheticDefaultImports, esModuleInterop: esModuleInterop, module: moduleKind }); | ||
this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode); | ||
if (this._languageService) { | ||
@@ -140,0 +142,0 @@ this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service'); |
@@ -438,7 +438,2 @@ "use strict"; | ||
}); | ||
// at least enable synthetic default imports (except if it's set in the input config) | ||
/* istanbul ignore next (already covered in unit test) */ | ||
if (!('allowSyntheticDefaultImports' in finalOptions)) { | ||
finalOptions.allowSyntheticDefaultImports = true; | ||
} | ||
} | ||
@@ -445,0 +440,0 @@ // Make sure when allowJs is enabled, outDir is required to have when using allowJs: true |
{ | ||
"name": "ts-jest", | ||
"version": "29.2.0", | ||
"version": "29.2.1", | ||
"main": "dist/index.js", | ||
@@ -55,2 +55,3 @@ "types": "dist/index.d.ts", | ||
"bs-logger": "0.x", | ||
"ejs": "^3.0.0", | ||
"fast-json-stable-stringify": "2.x", | ||
@@ -115,8 +116,7 @@ "jest-util": "^29.0.0", | ||
"@types/yargs-parser": "21.0.3", | ||
"@typescript-eslint/eslint-plugin": "^7.15.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"@typescript-eslint/eslint-plugin": "^7.16.0", | ||
"@typescript-eslint/parser": "^7.16.0", | ||
"babel-jest": "^29.7.0", | ||
"conventional-changelog-cli": "^5.0.0", | ||
"cross-spawn": "latest", | ||
"ejs": "^3.1.10", | ||
"esbuild": "~0.21.5", | ||
@@ -127,3 +127,3 @@ "eslint": "^8.57.0", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-jsdoc": "^48.5.2", | ||
"eslint-plugin-jsdoc": "^48.6.0", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
@@ -130,0 +130,0 @@ "eslint-plugin-prettier": "^4.2.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326529
43
15
4450
+ Addedejs@^3.0.0
+ Added@types/node@22.5.4(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcaniuse-lite@1.0.30001658(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedejs@3.1.10(transitive)
+ Addedelectron-to-chromium@1.5.18(transitive)
+ Addedfilelist@1.0.4(transitive)
+ Addedjake@10.9.2(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedms@2.1.3(transitive)
- Removed@types/node@22.5.3(transitive)
- Removedcaniuse-lite@1.0.30001655(transitive)
- Removeddebug@4.3.6(transitive)
- Removedelectron-to-chromium@1.5.13(transitive)
- Removedms@2.1.2(transitive)