ts-jest 29.3.0 → 29.3.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 +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/legacy/compiler/ts-compiler.d.ts +1 -2
- package/dist/legacy/compiler/ts-compiler.js +19 -15
- package/dist/legacy/config/config-set.js +2 -2
- package/dist/legacy/ts-jest-transformer.d.ts +0 -3
- package/dist/legacy/ts-jest-transformer.js +24 -16
- package/dist/transpilers/typescript/transpile-module.d.ts +5 -1
- package/dist/transpilers/typescript/transpile-module.js +21 -8
- package/dist/utils/json.js +0 -26
- package/package.json +15 -15
- package/sonar-project.properties +16 -0
package/.ts-jest-digest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f23c7d9044c4051d802f7e95e657393a9fc3c810
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [29.3.2](https://github.com/kulshekhar/ts-jest/compare/v29.3.1...v29.3.2) (2025-04-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix: transpile `js` files from `node_modules` whenever Jest asks ([968370e](https://github.com/kulshekhar/ts-jest/commit/968370e)), closes [#4637](https://github.com/kulshekhar/ts-jest/issues/4637)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [29.3.1](https://github.com/kulshekhar/ts-jest/compare/v29.3.0...v29.3.1) (2025-03-31)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix: allow `isolatedModules` mode to have `ts.Program` under `Node16/Next` ([25157eb](https://github.com/kulshekhar/ts-jest/commit/25157eb))
|
|
16
|
+
* fix: improve message for `isolatedModules` of `ts-jest` config ([547eb6f](https://github.com/kulshekhar/ts-jest/commit/547eb6f))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
1
20
|
## [29.3.0](https://github.com/kulshekhar/ts-jest/compare/v29.2.6...v29.3.0) (2025-03-21)
|
|
2
21
|
|
|
3
22
|
|
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ See also the list of [contributors](https://github.com/kulshekhar/ts-jest/contri
|
|
|
67
67
|
|
|
68
68
|
## Supporters
|
|
69
69
|
|
|
70
|
-
- [JetBrains](https://www.jetbrains.com/?from=ts-jest) has been kind enough to support ts-jest with
|
|
70
|
+
- [JetBrains](https://www.jetbrains.com/?from=ts-jest) has been kind enough to support ts-jest with a [license for open source] (https://www.jetbrains.com/community/opensource/?from=ts-jest).
|
|
71
71
|
|
|
72
72
|
## License
|
|
73
73
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Logger } from 'bs-logger';
|
|
2
2
|
import { CompilerOptions, CustomTransformers, Program, TranspileOutput } from 'typescript';
|
|
3
|
-
import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TsJestCompileOptions, TTypeScript } from '../../types';
|
|
4
|
-
import { CompiledOutput } from '../../types';
|
|
3
|
+
import type { StringMap, TsCompilerInstance, TsJestAstTransformer, TsJestCompileOptions, TTypeScript, CompiledOutput } from '../../types';
|
|
5
4
|
import type { ConfigSet } from '../config/config-set';
|
|
6
5
|
export declare class TsCompiler implements TsCompilerInstance {
|
|
7
6
|
readonly configSet: ConfigSet;
|
|
@@ -56,21 +56,10 @@ var bs_logger_1 = require("bs-logger");
|
|
|
56
56
|
var lodash_memoize_1 = __importDefault(require("lodash.memoize"));
|
|
57
57
|
var typescript_1 = __importDefault(require("typescript"));
|
|
58
58
|
var constants_1 = require("../../constants");
|
|
59
|
-
// import { tsTranspileModule } from '../../transpilers/typescript/transpile-module'
|
|
60
59
|
var transpile_module_1 = require("../../transpilers/typescript/transpile-module");
|
|
61
60
|
var utils_1 = require("../../utils");
|
|
62
61
|
var messages_1 = require("../../utils/messages");
|
|
63
62
|
var compiler_utils_1 = require("./compiler-utils");
|
|
64
|
-
var isModernNodeResolution = function (module) {
|
|
65
|
-
return module ? [typescript_1.default.ModuleKind.Node16, /* ModuleKind.Node18 */ 101, typescript_1.default.ModuleKind.NodeNext].includes(module) : false;
|
|
66
|
-
};
|
|
67
|
-
var shouldUseNativeTsTranspile = function (compilerOptions) {
|
|
68
|
-
if (!compilerOptions) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
var module = compilerOptions.module;
|
|
72
|
-
return !isModernNodeResolution(module);
|
|
73
|
-
};
|
|
74
63
|
var assertCompilerOptionsWithJestTransformMode = function (compilerOptions, isEsmMode, logger) {
|
|
75
64
|
if (isEsmMode && compilerOptions.module === typescript_1.default.ModuleKind.CommonJS) {
|
|
76
65
|
logger.error("The current compiler option \"module\" value is not suitable for Jest ESM mode. Please either use ES module kinds or Node16/NodeNext module kinds with \"type: module\" in package.json" /* Errors.InvalidModuleKindForEsm */);
|
|
@@ -142,7 +131,7 @@ var TsCompiler = /** @class */ (function () {
|
|
|
142
131
|
}
|
|
143
132
|
var moduleKind = (_b = compilerOptions.module) !== null && _b !== void 0 ? _b : this._ts.ModuleKind.ESNext;
|
|
144
133
|
var esModuleInterop = compilerOptions.esModuleInterop;
|
|
145
|
-
if (
|
|
134
|
+
if ((0, transpile_module_1.isModernNodeModuleKind)(moduleKind)) {
|
|
146
135
|
esModuleInterop = true;
|
|
147
136
|
moduleKind = this._ts.ModuleKind.ESNext;
|
|
148
137
|
}
|
|
@@ -156,12 +145,18 @@ var TsCompiler = /** @class */ (function () {
|
|
|
156
145
|
var e_1, _a;
|
|
157
146
|
var isEsmMode = this.configSet.useESM && options.supportsStaticESM;
|
|
158
147
|
this._compilerOptions = this.fixupCompilerOptionsForModuleKind(this._initialCompilerOptions, isEsmMode);
|
|
159
|
-
if (!this._initialCompilerOptions.isolatedModules &&
|
|
148
|
+
if (!this._initialCompilerOptions.isolatedModules && (0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
|
160
149
|
this._logger.warn("Using hybrid module kind (Node16/18/Next) is only supported in \"isolatedModules: true\". Please set \"isolatedModules: true\" in your tsconfig.json." /* Helps.UsingModernNodeResolution */);
|
|
161
150
|
}
|
|
162
151
|
var moduleKind = this._initialCompilerOptions.module;
|
|
163
152
|
var currentModuleKind = this._compilerOptions.module;
|
|
164
153
|
if (this._languageService) {
|
|
154
|
+
if (constants_1.JS_JSX_REGEX.test(fileName) && !this._compilerOptions.allowJs) {
|
|
155
|
+
this._logger.warn({ fileName: fileName }, (0, messages_1.interpolate)("Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore" /* Errors.GotJsFileButAllowJsFalse */, { path: fileName }));
|
|
156
|
+
return {
|
|
157
|
+
code: fileContent,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
165
160
|
this._logger.debug({ fileName: fileName }, 'getCompiledOutput(): compiling using language service');
|
|
166
161
|
// Must set memory cache before attempting to compile
|
|
167
162
|
this._updateMemoryCache(fileContent, fileName, currentModuleKind === moduleKind);
|
|
@@ -235,7 +230,13 @@ var TsCompiler = /** @class */ (function () {
|
|
|
235
230
|
}
|
|
236
231
|
};
|
|
237
232
|
TsCompiler.prototype._transpileOutput = function (fileContent, fileName) {
|
|
238
|
-
|
|
233
|
+
var _this = this;
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated
|
|
236
|
+
*
|
|
237
|
+
* This code path should be removed in the next major version to benefit from checking on compiler options
|
|
238
|
+
*/
|
|
239
|
+
if (!(0, transpile_module_1.isModernNodeModuleKind)(this._initialCompilerOptions.module)) {
|
|
239
240
|
return this._ts.transpileModule(fileContent, {
|
|
240
241
|
fileName: fileName,
|
|
241
242
|
transformers: this._makeTransformers(this.configSet.resolvedTransformers),
|
|
@@ -245,7 +246,10 @@ var TsCompiler = /** @class */ (function () {
|
|
|
245
246
|
}
|
|
246
247
|
return (0, transpile_module_1.tsTranspileModule)(fileContent, {
|
|
247
248
|
fileName: fileName,
|
|
248
|
-
transformers:
|
|
249
|
+
transformers: function (program) {
|
|
250
|
+
_this.program = program;
|
|
251
|
+
return _this._makeTransformers(_this.configSet.resolvedTransformers);
|
|
252
|
+
},
|
|
249
253
|
compilerOptions: this._initialCompilerOptions,
|
|
250
254
|
reportDiagnostics: fileName ? this.configSet.shouldReportDiagnostics(fileName) : false,
|
|
251
255
|
});
|
|
@@ -225,12 +225,12 @@ var ConfigSet = /** @class */ (function () {
|
|
|
225
225
|
if (options.isolatedModules) {
|
|
226
226
|
this.parsedTsConfig.options.isolatedModules = true;
|
|
227
227
|
if (this.tsconfigFilePath) {
|
|
228
|
-
this.logger.warn((0, messages_1.interpolate)("\"isolatedModules\" is deprecated and will be removed in v30.0.0. Please
|
|
228
|
+
this.logger.warn((0, messages_1.interpolate)("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\" in {{tsconfigFilePath}} instead, see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithTsconfigPath */, {
|
|
229
229
|
tsconfigFilePath: this.tsconfigFilePath,
|
|
230
230
|
}));
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
|
-
this.logger.warn("\"isolatedModules\" is deprecated and will be removed in v30.0.0. Please
|
|
233
|
+
this.logger.warn("\n The \"ts-jest\" config option \"isolatedModules\" is deprecated and will be removed in v30.0.0. Please use \"isolatedModules: true\", see https://www.typescriptlang.org/tsconfig/#isolatedModules\n " /* Deprecations.IsolatedModulesWithoutTsconfigPath */);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
this.isolatedModules = (_f = this.parsedTsConfig.options.isolatedModules) !== null && _f !== void 0 ? _f : false;
|
|
@@ -12,9 +12,6 @@ export declare class TsJestTransformer implements SyncTransformer<TsJestTransfor
|
|
|
12
12
|
private _configsFor;
|
|
13
13
|
protected _createConfigSet(config: TsJestTransformOptions['config'] | undefined): ConfigSet;
|
|
14
14
|
protected _createCompiler(configSet: ConfigSet, cacheFS: Map<string, string>): void;
|
|
15
|
-
/**
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
15
|
process(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): TransformedSource;
|
|
19
16
|
processAsync(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): Promise<TransformedSource>;
|
|
20
17
|
private processWithTs;
|
|
@@ -78,13 +78,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
78
78
|
exports.TsJestTransformer = exports.CACHE_KEY_EL_SEPARATOR = void 0;
|
|
79
79
|
var fs_1 = require("fs");
|
|
80
80
|
var path_1 = __importDefault(require("path"));
|
|
81
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
81
82
|
var constants_1 = require("../constants");
|
|
82
83
|
var utils_1 = require("../utils");
|
|
83
84
|
var importer_1 = require("../utils/importer");
|
|
84
85
|
var messages_1 = require("../utils/messages");
|
|
85
86
|
var sha1_1 = require("../utils/sha1");
|
|
86
87
|
var compiler_1 = require("./compiler");
|
|
88
|
+
var compiler_utils_1 = require("./compiler/compiler-utils");
|
|
87
89
|
var config_set_1 = require("./config/config-set");
|
|
90
|
+
var isNodeModule = function (filePath) {
|
|
91
|
+
return path_1.default.normalize(filePath).split(path_1.default.sep).includes('node_modules');
|
|
92
|
+
};
|
|
88
93
|
/**
|
|
89
94
|
* @internal
|
|
90
95
|
*/
|
|
@@ -169,9 +174,6 @@ var TsJestTransformer = /** @class */ (function () {
|
|
|
169
174
|
TsJestTransformer.prototype._createCompiler = function (configSet, cacheFS) {
|
|
170
175
|
this._compiler = new compiler_1.TsJestCompiler(configSet, cacheFS);
|
|
171
176
|
};
|
|
172
|
-
/**
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
175
177
|
TsJestTransformer.prototype.process = function (sourceText, sourcePath, transformOptions) {
|
|
176
178
|
this._logger.debug({ fileName: sourcePath, transformOptions: transformOptions }, 'processing', sourcePath);
|
|
177
179
|
var configs = this._configsFor(transformOptions);
|
|
@@ -240,20 +242,26 @@ var TsJestTransformer = /** @class */ (function () {
|
|
|
240
242
|
code: '',
|
|
241
243
|
};
|
|
242
244
|
}
|
|
243
|
-
else if (!configs.parsedTsConfig.options.allowJs && isJsFile) {
|
|
244
|
-
// we've got a '.js' but the compiler option `allowJs` is not set or set to false
|
|
245
|
-
this._logger.warn({ fileName: sourcePath }, (0, messages_1.interpolate)("Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore" /* Errors.GotJsFileButAllowJsFalse */, { path: sourcePath }));
|
|
246
|
-
result = {
|
|
247
|
-
code: sourceText,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
245
|
else if (isJsFile || isTsFile) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
if (isJsFile && isNodeModule(sourcePath)) {
|
|
247
|
+
var transpiledResult = typescript_1.default.transpileModule(sourceText, {
|
|
248
|
+
compilerOptions: __assign(__assign({}, configs.parsedTsConfig.options), { module: transformOptions.supportsStaticESM && transformOptions.transformerConfig.useESM
|
|
249
|
+
? typescript_1.default.ModuleKind.ESNext
|
|
250
|
+
: typescript_1.default.ModuleKind.CommonJS }),
|
|
251
|
+
fileName: sourcePath,
|
|
252
|
+
});
|
|
253
|
+
result = {
|
|
254
|
+
code: (0, compiler_utils_1.updateOutput)(transpiledResult.outputText, sourcePath, transpiledResult.sourceMapText),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
// transpile TS code (source maps are included)
|
|
259
|
+
result = this._compiler.getCompiledOutput(sourceText, sourcePath, {
|
|
260
|
+
depGraphs: this._depGraphs,
|
|
261
|
+
supportsStaticESM: transformOptions.supportsStaticESM,
|
|
262
|
+
watchMode: this._watchMode,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
257
265
|
}
|
|
258
266
|
else {
|
|
259
267
|
// we should not get called for files with other extension than js[x], ts[x] and d.ts,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
type
|
|
2
|
+
type ExtendedTranspileOptions = Omit<ts.TranspileOptions, 'transformers'> & {
|
|
3
|
+
transformers?: (program: ts.Program) => ts.CustomTransformers;
|
|
4
|
+
};
|
|
5
|
+
type ExtendedTsTranspileModuleFn = (fileContent: string, transpileOptions: ExtendedTranspileOptions) => ts.TranspileOutput;
|
|
6
|
+
export declare const isModernNodeModuleKind: (module: ts.ModuleKind | undefined) => boolean;
|
|
3
7
|
export declare const tsTranspileModule: ExtendedTsTranspileModuleFn;
|
|
4
8
|
export {};
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.tsTranspileModule = void 0;
|
|
42
|
+
exports.tsTranspileModule = exports.isModernNodeModuleKind = void 0;
|
|
43
43
|
var node_path_1 = __importDefault(require("node:path"));
|
|
44
44
|
var typescript_1 = __importDefault(require("typescript"));
|
|
45
45
|
var messages_1 = require("../../utils/messages");
|
|
@@ -57,6 +57,13 @@ function getNewLineCharacter(options) {
|
|
|
57
57
|
return lineFeed;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
var isModernNodeModuleKind = function (module) {
|
|
61
|
+
return module ? [typescript_1.default.ModuleKind.Node16, /* ModuleKind.Node18 */ 101, typescript_1.default.ModuleKind.NodeNext].includes(module) : false;
|
|
62
|
+
};
|
|
63
|
+
exports.isModernNodeModuleKind = isModernNodeModuleKind;
|
|
64
|
+
var shouldCheckProjectPkgJsonContent = function (fileName, moduleKind) {
|
|
65
|
+
return fileName.endsWith('package.json') && (0, exports.isModernNodeModuleKind)(moduleKind);
|
|
66
|
+
};
|
|
60
67
|
/**
|
|
61
68
|
* Copy source code of {@link ts.transpileModule} from {@link https://github.com/microsoft/TypeScript/blob/main/src/services/transpile.ts}
|
|
62
69
|
* with extra modifications:
|
|
@@ -65,7 +72,7 @@ function getNewLineCharacter(options) {
|
|
|
65
72
|
*/
|
|
66
73
|
var transpileWorker = function (input, transpileOptions) {
|
|
67
74
|
var e_1, _a;
|
|
68
|
-
var _b, _c, _d, _e;
|
|
75
|
+
var _b, _c, _d, _e, _f;
|
|
69
76
|
barebonesLibSourceFile !== null && barebonesLibSourceFile !== void 0 ? barebonesLibSourceFile : (barebonesLibSourceFile = typescript_1.default.createSourceFile(barebonesLibName, barebonesLibContent, {
|
|
70
77
|
languageVersion: typescript_1.default.ScriptTarget.Latest,
|
|
71
78
|
}));
|
|
@@ -83,8 +90,8 @@ var transpileWorker = function (input, transpileOptions) {
|
|
|
83
90
|
}
|
|
84
91
|
try {
|
|
85
92
|
// @ts-expect-error internal TypeScript API
|
|
86
|
-
for (var
|
|
87
|
-
var option =
|
|
93
|
+
for (var _g = __values(typescript_1.default.transpileOptionValueCompilerOptions), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
94
|
+
var option = _h.value;
|
|
88
95
|
// Do not set redundant config options if `verbatimModuleSyntax` was supplied.
|
|
89
96
|
if (options.verbatimModuleSyntax && new Set(['isolatedModules']).has(option.name)) {
|
|
90
97
|
continue;
|
|
@@ -95,7 +102,7 @@ var transpileWorker = function (input, transpileOptions) {
|
|
|
95
102
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
96
103
|
finally {
|
|
97
104
|
try {
|
|
98
|
-
if (
|
|
105
|
+
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
|
|
99
106
|
}
|
|
100
107
|
finally { if (e_1) throw e_1.error; }
|
|
101
108
|
}
|
|
@@ -132,10 +139,16 @@ var transpileWorker = function (input, transpileOptions) {
|
|
|
132
139
|
getCurrentDirectory: function () { return ''; },
|
|
133
140
|
getNewLine: function () { return newLine; },
|
|
134
141
|
fileExists: function (fileName) {
|
|
135
|
-
|
|
142
|
+
if (shouldCheckProjectPkgJsonContent(fileName, options.module)) {
|
|
143
|
+
return typescript_1.default.sys.fileExists(fileName);
|
|
144
|
+
}
|
|
145
|
+
return fileName === inputFileName;
|
|
136
146
|
},
|
|
137
147
|
readFile: function (fileName) {
|
|
138
|
-
|
|
148
|
+
if (shouldCheckProjectPkgJsonContent(fileName, options.module)) {
|
|
149
|
+
return typescript_1.default.sys.readFile(fileName);
|
|
150
|
+
}
|
|
151
|
+
return '';
|
|
139
152
|
},
|
|
140
153
|
directoryExists: function () { return true; },
|
|
141
154
|
getDirectories: function () { return []; },
|
|
@@ -169,7 +182,7 @@ var transpileWorker = function (input, transpileOptions) {
|
|
|
169
182
|
/*targetSourceFile*/ undefined,
|
|
170
183
|
/*writeFile*/ undefined,
|
|
171
184
|
/*cancellationToken*/ undefined,
|
|
172
|
-
/*emitOnlyDtsFiles*/ undefined, transpileOptions.transformers);
|
|
185
|
+
/*emitOnlyDtsFiles*/ undefined, (_f = transpileOptions.transformers) === null || _f === void 0 ? void 0 : _f.call(transpileOptions, program));
|
|
173
186
|
diagnostics.push.apply(diagnostics, __spreadArray([], __read(result.diagnostics), false));
|
|
174
187
|
if (outputText === undefined) {
|
|
175
188
|
diagnostics.push({
|
package/dist/utils/json.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.stringify = stringify;
|
|
7
7
|
exports.parse = parse;
|
|
8
|
-
exports.normalize = normalize;
|
|
9
8
|
var fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
|
|
10
9
|
var UNDEFINED = 'undefined';
|
|
11
10
|
function stringify(input) {
|
|
@@ -15,28 +14,3 @@ function stringify(input) {
|
|
|
15
14
|
function parse(input) {
|
|
16
15
|
return input === UNDEFINED ? undefined : JSON.parse(input);
|
|
17
16
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
function normalize(input, _a) {
|
|
22
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.parse, parser = _c === void 0 ? parse : _c;
|
|
23
|
-
var result;
|
|
24
|
-
if (normalize.cache.has(input)) {
|
|
25
|
-
result = normalize.cache.get(input);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
var data = parser(input);
|
|
29
|
-
result = stringify(data);
|
|
30
|
-
if (result === input)
|
|
31
|
-
result = undefined;
|
|
32
|
-
normalize.cache.set(input, result);
|
|
33
|
-
}
|
|
34
|
-
return result !== null && result !== void 0 ? result : input;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
40
|
-
(function (normalize) {
|
|
41
|
-
normalize.cache = new Map();
|
|
42
|
-
})(normalize || (exports.normalize = normalize = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-jest",
|
|
3
|
-
"version": "29.3.
|
|
3
|
+
"version": "29.3.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"build": "tsc -p tsconfig.build.json",
|
|
14
14
|
"postbuild": "node scripts/post-build.js",
|
|
15
15
|
"test": "jest -c=jest.config.ts",
|
|
16
|
-
"test-e2e-cjs": "jest -c=jest-e2e.config.
|
|
17
|
-
"test-e2e-esm": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-e2e.config.
|
|
16
|
+
"test-e2e-cjs": "jest -c=jest-e2e-cjs.config.ts --no-cache",
|
|
17
|
+
"test-e2e-esm": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-e2e-esm.config.ts --no-cache",
|
|
18
18
|
"test-examples": "node scripts/test-examples.js",
|
|
19
19
|
"lint": "eslint .",
|
|
20
20
|
"lint-fix": "eslint --fix .",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"lodash.memoize": "^4.1.2",
|
|
60
60
|
"make-error": "^1.3.6",
|
|
61
61
|
"semver": "^7.7.1",
|
|
62
|
-
"type-fest": "^4.
|
|
62
|
+
"type-fest": "^4.39.1",
|
|
63
63
|
"yargs-parser": "^21.1.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@commitlint/cli": "^19.8.0",
|
|
92
92
|
"@commitlint/config-angular": "^19.8.0",
|
|
93
|
-
"@eslint/compat": "^1.2.
|
|
93
|
+
"@eslint/compat": "^1.2.8",
|
|
94
94
|
"@eslint/eslintrc": "^3.3.1",
|
|
95
|
-
"@eslint/js": "^9.
|
|
95
|
+
"@eslint/js": "^9.24.0",
|
|
96
96
|
"@jest/globals": "^29.7.0",
|
|
97
97
|
"@jest/transform": "^29.7.0",
|
|
98
98
|
"@jest/types": "^29.6.3",
|
|
@@ -105,17 +105,17 @@
|
|
|
105
105
|
"@types/lodash.memoize": "^4.1.9",
|
|
106
106
|
"@types/lodash.set": "^4.3.9",
|
|
107
107
|
"@types/micromatch": "^4.0.9",
|
|
108
|
-
"@types/node": "20.17.
|
|
109
|
-
"@types/semver": "^7.
|
|
108
|
+
"@types/node": "20.17.30",
|
|
109
|
+
"@types/semver": "^7.7.0",
|
|
110
110
|
"@types/yargs": "^17.0.33",
|
|
111
111
|
"@types/yargs-parser": "21.0.3",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
113
|
-
"@typescript-eslint/parser": "^8.
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
113
|
+
"@typescript-eslint/parser": "^8.29.1",
|
|
114
114
|
"babel-jest": "^29.7.0",
|
|
115
115
|
"conventional-changelog-cli": "^5.0.0",
|
|
116
|
-
"esbuild": "~0.25.
|
|
117
|
-
"eslint": "^9.
|
|
118
|
-
"eslint-config-prettier": "^10.1.
|
|
116
|
+
"esbuild": "~0.25.2",
|
|
117
|
+
"eslint": "^9.24.0",
|
|
118
|
+
"eslint-config-prettier": "^10.1.2",
|
|
119
119
|
"eslint-plugin-import": "^2.31.0",
|
|
120
120
|
"eslint-plugin-jest": "^28.11.0",
|
|
121
121
|
"eslint-plugin-jsdoc": "^50.6.9",
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"husky": "^9.1.7",
|
|
129
129
|
"jest": "^29.7.0",
|
|
130
130
|
"js-yaml": "^4.1.0",
|
|
131
|
-
"lint-staged": "^15.5.
|
|
131
|
+
"lint-staged": "^15.5.1",
|
|
132
132
|
"memfs": "^4.17.0",
|
|
133
133
|
"prettier": "^2.8.8",
|
|
134
134
|
"rimraf": "^5.0.10",
|
|
135
135
|
"typescript": "~5.5.4",
|
|
136
|
-
"typescript-eslint": "^8.
|
|
136
|
+
"typescript-eslint": "^8.29.1"
|
|
137
137
|
},
|
|
138
138
|
"engines": {
|
|
139
139
|
"node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
sonar.organization=kulshekhar-ts-jest
|
|
2
|
+
sonar.projectKey=kulshekhar_ts-jest
|
|
3
|
+
sonar.sources=src
|
|
4
|
+
sonar.language=ts
|
|
5
|
+
sonar.sourceEncoding=UTF-8
|
|
6
|
+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
|
7
|
+
sonar.typescript.tsconfigPath=tsconfig.json
|
|
8
|
+
sonar.exclusions=\
|
|
9
|
+
**/*.md, \
|
|
10
|
+
**/jest.config.ts, \
|
|
11
|
+
**/jest-*.config.ts, \
|
|
12
|
+
**/*.spec.ts, \
|
|
13
|
+
**/**.spec.ts, \
|
|
14
|
+
src/__helpers__/**, \
|
|
15
|
+
src/__mocks__/**, \
|
|
16
|
+
website/**
|