Comparing version 29.1.5 to 29.2.0
@@ -70,2 +70,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -75,4 +78,12 @@ exports.help = exports.run = void 0; | ||
var path_1 = require("path"); | ||
var ejs_1 = __importDefault(require("ejs")); | ||
var json5_1 = require("json5"); | ||
var presets_1 = require("../helpers/presets"); | ||
var constants_1 = require("../../constants"); | ||
var create_jest_preset_1 = require("../../presets/create-jest-preset"); | ||
var ensureOnlyUsingDoubleQuotes = function (str) { | ||
return str | ||
.replace(/"'(.*?)'"/g, '"$1"') | ||
.replace(/'ts-jest'/g, '"ts-jest"') | ||
.replace(/'babel-jest'/g, '"babel-jest"'); | ||
}; | ||
/** | ||
@@ -82,47 +93,32 @@ * @internal | ||
var run = function (args /* , logger: Logger */) { return __awaiter(void 0, void 0, void 0, function () { | ||
var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, jestConfig, transformerConfig, content, usesModules; | ||
var _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
var askedTsconfig, force, jsdom, jsFilesProcessor, shouldPostProcessWithBabel, file, filePath, name, isPackageJsonConfig, isJestConfigFileExisted, pkgFile, isPackageJsonExisted, tsconfig, pkgJsonContent, body, resolvedTsconfigOption, transformConfig, _a, transformPattern, transformValue; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
askedTsconfig = args.tsconfig, force = args.force, jsdom = args.jsdom, jsFilesProcessor = args.js, shouldPostProcessWithBabel = args.babel; | ||
file = (_c = (_b = args._[0]) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : 'jest.config.js'; | ||
filePath = (0, path_1.join)(process.cwd(), file); | ||
name = (0, path_1.basename)(file); | ||
isPackage = name === 'package.json'; | ||
exists = (0, fs_1.existsSync)(filePath); | ||
pkgFile = isPackage ? filePath : (0, path_1.join)(process.cwd(), 'package.json'); | ||
hasPackage = isPackage || (0, fs_1.existsSync)(pkgFile); | ||
_a = args.jestPreset, jestPreset = _a === void 0 ? true : _a, askedTsconfig = args.tsconfig, force = args.force, jsdom = args.jsdom; | ||
isPackageJsonConfig = name === 'package.json'; | ||
isJestConfigFileExisted = (0, fs_1.existsSync)(filePath); | ||
pkgFile = isPackageJsonConfig ? filePath : (0, path_1.join)(process.cwd(), 'package.json'); | ||
isPackageJsonExisted = isPackageJsonConfig || (0, fs_1.existsSync)(pkgFile); | ||
tsconfig = askedTsconfig === 'tsconfig.json' ? undefined : askedTsconfig; | ||
pkgJson = hasPackage ? JSON.parse((0, fs_1.readFileSync)(pkgFile, 'utf8')) : {}; | ||
jsFilesProcessor = args.js, shouldPostProcessWithBabel = args.babel; | ||
// set defaults for missing options | ||
if (jsFilesProcessor == null) { | ||
// set default js files processor depending on whether the user wants to post-process with babel | ||
jsFilesProcessor = shouldPostProcessWithBabel ? 'babel' : undefined; | ||
pkgJsonContent = isPackageJsonExisted ? JSON.parse((0, fs_1.readFileSync)(pkgFile, 'utf8')) : {}; | ||
if (shouldPostProcessWithBabel) { | ||
console.warn("The option --babel is deprecated and will be removed in the next major version." + | ||
" Please specify 'js' option value (see more with npx ts-jest help) if you wish 'ts-jest' to process 'js' with TypeScript API or Babel."); | ||
} | ||
else if (shouldPostProcessWithBabel == null) { | ||
// auto enables babel post-processing if the user wants babel to process js files | ||
shouldPostProcessWithBabel = jsFilesProcessor === 'babel'; | ||
} | ||
if (jsFilesProcessor === 'babel') { | ||
preset = presets_1.jsWIthBabel; | ||
} | ||
else if (jsFilesProcessor === 'ts') { | ||
preset = presets_1.jsWithTs; | ||
} | ||
else { | ||
preset = presets_1.defaults; | ||
} | ||
if (isPackage && !exists) { | ||
if (isPackageJsonConfig && !isJestConfigFileExisted) { | ||
throw new Error("File ".concat(file, " does not exists.")); | ||
} | ||
else if (!isPackage && exists && !force) { | ||
else if (!isPackageJsonConfig && isJestConfigFileExisted && !force) { | ||
throw new Error("Configuration file ".concat(file, " already exists.")); | ||
} | ||
if (!isPackage && !name.endsWith('.js')) { | ||
if (!isPackageJsonConfig && !name.endsWith('.js')) { | ||
throw new TypeError("Configuration file ".concat(file, " must be a .js file or the package.json.")); | ||
} | ||
if (hasPackage && pkgJson.jest) { | ||
if (force && !isPackage) { | ||
delete pkgJson.jest; | ||
(0, fs_1.writeFileSync)(pkgFile, JSON.stringify(pkgJson, undefined, ' ')); | ||
if (isPackageJsonExisted && pkgJsonContent.jest) { | ||
if (force && !isPackageJsonConfig) { | ||
delete pkgJsonContent.jest; | ||
(0, fs_1.writeFileSync)(pkgFile, JSON.stringify(pkgJsonContent, undefined, ' ')); | ||
} | ||
@@ -133,56 +129,24 @@ else if (!force) { | ||
} | ||
if (isPackage) { | ||
jestConfig = jestPreset ? { preset: preset.name } : __assign({}, preset.value); | ||
if (!jsdom) | ||
jestConfig.testEnvironment = 'node'; | ||
transformerConfig = Object.entries((_d = jestConfig.transform) !== null && _d !== void 0 ? _d : {}).reduce(function (acc, _a) { | ||
var _b, _c; | ||
var _d = __read(_a, 2), fileRegex = _d[0], transformerConfig = _d[1]; | ||
if (tsconfig || shouldPostProcessWithBabel) { | ||
var tsJestConf = {}; | ||
if (tsconfig) | ||
tsJestConf.tsconfig = tsconfig; | ||
if (shouldPostProcessWithBabel) | ||
tsJestConf.babelConfig = true; | ||
return __assign(__assign({}, acc), (_b = {}, _b[fileRegex] = typeof transformerConfig === 'string' | ||
? [transformerConfig, tsJestConf] | ||
: [transformerConfig[0], __assign(__assign({}, transformerConfig[1]), tsJestConf)], _b)); | ||
} | ||
return __assign(__assign({}, acc), (_c = {}, _c[fileRegex] = transformerConfig, _c)); | ||
}, {}); | ||
if (Object.keys(transformerConfig).length) { | ||
jestConfig.transform = __assign(__assign({}, jestConfig.transform), transformerConfig); | ||
} | ||
body = JSON.stringify(__assign(__assign({}, pkgJson), { jest: jestConfig }), undefined, ' '); | ||
resolvedTsconfigOption = tsconfig ? { tsconfig: "".concat((0, json5_1.stringify)(tsconfig)) } : undefined; | ||
if (jsFilesProcessor === 'babel' || shouldPostProcessWithBabel) { | ||
transformConfig = (0, create_jest_preset_1.createJsWithBabelPreset)(resolvedTsconfigOption); | ||
} | ||
else if (jsFilesProcessor === 'ts') { | ||
transformConfig = (0, create_jest_preset_1.createJsWithTsPreset)(resolvedTsconfigOption); | ||
} | ||
else { | ||
content = []; | ||
if (!jestPreset) { | ||
content.push("".concat(preset.jsImport('tsjPreset'), ";"), ''); | ||
} | ||
content.push("/** @type {import('ts-jest').JestConfigWithTsJest} */"); | ||
usesModules = pkgJson.type === 'module'; | ||
content.push(usesModules ? 'export default {' : 'module.exports = {'); | ||
if (jestPreset) { | ||
content.push(" preset: '".concat(preset.name, "',")); | ||
} | ||
else { | ||
content.push(' ...tsjPreset,'); | ||
} | ||
if (!jsdom) | ||
content.push(" testEnvironment: 'node',"); | ||
if (tsconfig || shouldPostProcessWithBabel) { | ||
content.push(' transform: {'); | ||
content.push(" '^.+\\\\.[tj]sx?$': ['ts-jest', {"); | ||
if (tsconfig) | ||
content.push(" tsconfig: ".concat((0, json5_1.stringify)(tsconfig), ",")); | ||
if (shouldPostProcessWithBabel) | ||
content.push(' babelConfig: true,'); | ||
content.push(' }],'); | ||
content.push(' },'); | ||
} | ||
content.push('};'); | ||
// join all together | ||
body = content.join('\n'); | ||
transformConfig = (0, create_jest_preset_1.createDefaultPreset)(resolvedTsconfigOption); | ||
} | ||
if (isPackageJsonConfig) { | ||
body = ensureOnlyUsingDoubleQuotes(JSON.stringify(__assign(__assign({}, pkgJsonContent), { jest: transformConfig }), undefined, ' ')); | ||
} | ||
else { | ||
_a = __read(Object.entries(transformConfig.transform)[0], 2), transformPattern = _a[0], transformValue = _a[1]; | ||
body = ejs_1.default.render(constants_1.JEST_CONFIG_EJS_TEMPLATE, { | ||
exportKind: pkgJsonContent.type === 'module' ? 'export default' : 'module.exports =', | ||
testEnvironment: jsdom ? 'jsdom' : 'node', | ||
transformPattern: transformPattern, | ||
transformValue: ensureOnlyUsingDoubleQuotes((0, json5_1.stringify)(transformValue)), | ||
}); | ||
} | ||
(0, fs_1.writeFileSync)(filePath, body); | ||
@@ -199,3 +163,3 @@ process.stderr.write("\nJest configuration written to \"".concat(filePath, "\".\n")); | ||
return __generator(this, function (_a) { | ||
process.stdout.write("\nUsage:\n ts-jest config:init [options] [<config-file>]\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n Default: jest.config.js\n\nOptions:\n --force Discard any existing Jest config\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n --tsconfig <file> Path to the tsconfig.json file\n --babel Pipe babel-jest after ts-jest\n --jsdom Use jsdom as test environment instead of node\n"); | ||
process.stdout.write("\nUsage:\n ts-jest config:init [options] [<config-file>]\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n Default: jest.config.js\n\nOptions:\n --force Discard any existing Jest config\n --js ts|babel Process '.js' files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n --tsconfig <file> Path to the tsconfig.json file\n --babel Enable using Babel to process 'js' resulted content from 'ts-jest' processing\n --jsdom Use 'jsdom' as test environment instead of 'node'\n"); | ||
return [2 /*return*/]; | ||
@@ -202,0 +166,0 @@ }); |
@@ -65,11 +65,2 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -85,4 +76,29 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var json5_1 = require("json5"); | ||
var create_jest_preset_1 = require("../../presets/create-jest-preset"); | ||
var backports_1 = require("../../utils/backports"); | ||
var presets_1 = require("../helpers/presets"); | ||
var migrateGlobalConfigToTransformConfig = function (transformConfig, globalsTsJestConfig) { | ||
if (transformConfig) { | ||
return Object.entries(transformConfig).reduce(function (previousValue, currentValue) { | ||
var _a, _b; | ||
var _c = __read(currentValue, 2), key = _c[0], transformOptions = _c[1]; | ||
if (typeof transformOptions === 'string' && transformOptions.includes('ts-jest')) { | ||
return __assign(__assign({}, previousValue), (_a = {}, _a[key] = globalsTsJestConfig ? ['ts-jest', globalsTsJestConfig] : 'ts-jest', _a)); | ||
} | ||
return __assign(__assign({}, previousValue), (_b = {}, _b[key] = transformOptions, _b)); | ||
}, {}); | ||
} | ||
return {}; | ||
}; | ||
var migratePresetToTransformConfig = function (transformConfig, preset, globalsTsJestConfig) { | ||
if (preset) { | ||
var transformConfigFromPreset = preset.name === "ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */ | ||
? (0, create_jest_preset_1.createJsWithTsPreset)(globalsTsJestConfig) | ||
: preset.name === "ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */ | ||
? (0, create_jest_preset_1.createJsWithBabelPreset)(globalsTsJestConfig) | ||
: (0, create_jest_preset_1.createDefaultPreset)(globalsTsJestConfig); | ||
return __assign(__assign({}, transformConfig), transformConfigFromPreset.transform); | ||
} | ||
return transformConfig; | ||
}; | ||
/** | ||
@@ -92,9 +108,8 @@ * @internal | ||
var run = function (args /* , logger: Logger*/) { return __awaiter(void 0, void 0, void 0, function () { | ||
var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, globalsTsJestConfig, migratedConfigTransform, presetValueTransform_1, before, after, stringify, prefix; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
return __generator(this, function (_l) { | ||
var nullLogger, file, filePath, name, isPackage, actualConfig, migratedConfig, preset, presetValue, migratedValue, presetValue, migratedValue, globalsTsJestConfig, before, after, stringify, prefix; | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
return __generator(this, function (_j) { | ||
nullLogger = (0, bs_logger_1.createLogger)({ targets: [] }); | ||
file = (_a = args._[0]) === null || _a === void 0 ? void 0 : _a.toString(); | ||
filePath = (0, path_1.resolve)(process.cwd(), file); | ||
footNotes = []; | ||
if (!(0, fs_1.existsSync)(filePath)) { | ||
@@ -116,54 +131,17 @@ throw new Error("Configuration file ".concat(file, " does not exists.")); | ||
migratedConfig = (0, backports_1.backportJestConfig)(nullLogger, actualConfig); | ||
// then we check if we can use `preset` | ||
if (!migratedConfig.preset && args.jestPreset) { | ||
// find the best preset | ||
if (migratedConfig.preset) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
preset = (_b = presets_1.allPresets[migratedConfig.preset]) !== null && _b !== void 0 ? _b : presets_1.allPresets["ts-jest/presets/default" /* JestPresetNames.default */]; | ||
} | ||
else { | ||
if (args.js) { | ||
presetName = args.js === 'babel' ? "ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */ : "ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */; | ||
preset = args.js === 'babel' ? presets_1.allPresets["ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */] : presets_1.allPresets["ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */]; | ||
} | ||
else { | ||
jsTransformers = Object.keys(migratedConfig.transform || {}).reduce(function (list, pattern) { | ||
if (RegExp(pattern.replace(/^<rootDir>\/?/, '/dummy-project/')).test('/dummy-project/src/foo.js')) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
var transformer = migratedConfig.transform[pattern]; | ||
if (/\bbabel-jest\b/.test(transformer)) | ||
transformer = 'babel-jest'; | ||
else if (/\ts-jest\b/.test(transformer)) | ||
transformer = 'ts-jest'; | ||
return __spreadArray(__spreadArray([], __read(list), false), [transformer], false); | ||
} | ||
return list; | ||
}, []); | ||
jsWithTs = jsTransformers.includes('ts-jest'); | ||
jsWithBabel = jsTransformers.includes('babel-jest'); | ||
if (jsWithBabel && !jsWithTs) { | ||
presetName = "ts-jest/presets/js-with-babel" /* JestPresetNames.jsWIthBabel */; | ||
} | ||
else if (jsWithTs && !jsWithBabel) { | ||
presetName = "ts-jest/presets/js-with-ts" /* JestPresetNames.jsWithTs */; | ||
} | ||
else { | ||
// sounds like js files are NOT handled, or handled with a unknown transformer, so we do not need to handle it | ||
presetName = "ts-jest/presets/default" /* JestPresetNames.default */; | ||
} | ||
preset = presets_1.allPresets["ts-jest/presets/default" /* JestPresetNames.default */]; | ||
} | ||
// ensure we are using a preset | ||
presetName = presetName !== null && presetName !== void 0 ? presetName : "ts-jest/presets/default" /* JestPresetNames.default */; | ||
preset = presets_1.allPresets[presetName]; | ||
footNotes.push("Detected preset '".concat(preset.label, "' as the best matching preset for your configuration.\nVisit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.\n")); | ||
} | ||
else if ((_b = migratedConfig.preset) === null || _b === void 0 ? void 0 : _b.startsWith('ts-jest')) { | ||
if (args.jestPreset === false) { | ||
delete migratedConfig.preset; | ||
} | ||
else { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
preset = (_c = presets_1.allPresets[migratedConfig.preset]) !== null && _c !== void 0 ? _c : presets_1.defaults; | ||
} | ||
} | ||
// enforce the correct name | ||
if (preset) | ||
migratedConfig.preset = preset.name; | ||
// check the extensions | ||
if (((_d = migratedConfig.moduleFileExtensions) === null || _d === void 0 ? void 0 : _d.length) && preset) { | ||
presetValue = dedupSort((_e = preset.value.moduleFileExtensions) !== null && _e !== void 0 ? _e : []).join('::'); | ||
if (((_c = migratedConfig.moduleFileExtensions) === null || _c === void 0 ? void 0 : _c.length) && preset) { | ||
presetValue = dedupSort((_d = preset.value.moduleFileExtensions) !== null && _d !== void 0 ? _d : []).join('::'); | ||
migratedValue = dedupSort(migratedConfig.moduleFileExtensions).join('::'); | ||
@@ -175,8 +153,8 @@ if (presetValue === migratedValue) { | ||
// there is a testRegex, remove our testMatch | ||
if ((typeof migratedConfig.testRegex === 'string' || ((_f = migratedConfig.testRegex) === null || _f === void 0 ? void 0 : _f.length)) && preset) { | ||
if (typeof migratedConfig.testRegex === 'string' || ((_e = migratedConfig.testRegex) === null || _e === void 0 ? void 0 : _e.length)) { | ||
delete migratedConfig.testMatch; | ||
} | ||
// check the testMatch | ||
else if (((_g = migratedConfig.testMatch) === null || _g === void 0 ? void 0 : _g.length) && preset) { | ||
presetValue = dedupSort((_h = preset.value.testMatch) !== null && _h !== void 0 ? _h : []).join('::'); | ||
else if (((_f = migratedConfig.testMatch) === null || _f === void 0 ? void 0 : _f.length) && preset) { | ||
presetValue = dedupSort((_g = preset.value.testMatch) !== null && _g !== void 0 ? _g : []).join('::'); | ||
migratedValue = dedupSort(migratedConfig.testMatch).join('::'); | ||
@@ -187,56 +165,5 @@ if (presetValue === migratedValue) { | ||
} | ||
// migrate the transform | ||
if (migratedConfig.transform) { | ||
Object.keys(migratedConfig.transform).forEach(function (key) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
var val = migratedConfig.transform[key]; | ||
if (typeof val === 'string' && /\/?ts-jest?(?:\/preprocessor\.js)?$/.test(val)) { | ||
// eslint-disable-next-line | ||
; | ||
migratedConfig.transform[key] = 'ts-jest'; | ||
} | ||
}); | ||
} | ||
globalsTsJestConfig = (_j = migratedConfig.globals) === null || _j === void 0 ? void 0 : _j['ts-jest']; | ||
if (globalsTsJestConfig && migratedConfig.transform) { | ||
Object.keys(migratedConfig.transform).forEach(function (key) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
var val = migratedConfig.transform[key]; | ||
if (typeof val === 'string' && val.includes('ts-jest')) { | ||
// eslint-disable-next-line | ||
; | ||
migratedConfig.transform[key] = Object.keys(globalsTsJestConfig).length ? [val, globalsTsJestConfig] : val; | ||
} | ||
}); | ||
delete ((_k = migratedConfig.globals) !== null && _k !== void 0 ? _k : Object.create(null))['ts-jest']; | ||
} | ||
// check if it's the same as the preset's one | ||
if (preset && migratedConfig.transform) { | ||
if ((0, fast_json_stable_stringify_1.default)(migratedConfig.transform) === (0, fast_json_stable_stringify_1.default)(preset.value.transform)) { | ||
delete migratedConfig.transform; | ||
} | ||
else { | ||
migratedConfigTransform = migratedConfig.transform; | ||
presetValueTransform_1 = preset.value.transform; | ||
if (migratedConfigTransform && presetValueTransform_1) { | ||
migratedConfig.transform = Object.entries(migratedConfigTransform).reduce( | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function (acc, _a) { | ||
var _b, _c; | ||
var _d = __read(_a, 2), fileRegex = _d[0], transformerConfig = _d[1]; | ||
var presetValueTransformerConfig = presetValueTransform_1[fileRegex]; | ||
var shouldRemoveDuplicatedConfig = (presetValueTransformerConfig && | ||
Array.isArray(presetValueTransformerConfig) && | ||
transformerConfig === presetValueTransformerConfig[0] && | ||
!Object.keys(presetValueTransformerConfig[1]).length) || | ||
transformerConfig === presetValueTransformerConfig; | ||
return shouldRemoveDuplicatedConfig | ||
? acc | ||
: acc | ||
? __assign(__assign({}, acc), (_b = {}, _b[fileRegex] = transformerConfig, _b)) : (_c = {}, _c[fileRegex] = transformerConfig, _c); | ||
}, undefined); | ||
} | ||
} | ||
} | ||
// cleanup | ||
globalsTsJestConfig = (_h = migratedConfig.globals) === null || _h === void 0 ? void 0 : _h['ts-jest']; | ||
migratedConfig.transform = migrateGlobalConfigToTransformConfig(migratedConfig.transform, globalsTsJestConfig); | ||
migratedConfig.transform = migratePresetToTransformConfig(migratedConfig.transform, preset, globalsTsJestConfig); | ||
cleanupConfig(actualConfig); | ||
@@ -252,23 +179,5 @@ cleanupConfig(migratedConfig); | ||
prefix = file.endsWith('.json') ? '"jest": ' : 'module.exports = '; | ||
// if we are using preset, inform the user that he might be able to remove some section(s) | ||
// we couldn't check for equality | ||
// if (usesPreset && migratedConfig.testMatch) { | ||
// footNotes.push(` | ||
// I couldn't check if your "testMatch" value is the same as mine which is: ${stringify( | ||
// presets.testMatch, | ||
// undefined, | ||
// ' ', | ||
// )} | ||
// If it is the case, you can safely remove the "testMatch" from what I've migrated. | ||
// `) | ||
// } | ||
if (preset && migratedConfig.transform) { | ||
footNotes.push("\nI couldn't check if your \"transform\" value is the same as mine which is: ".concat(stringify(preset.value.transform, undefined, ' '), "\nIf it is the case, you can safely remove the \"transform\" from what I've migrated.\n")); | ||
} | ||
// output new config | ||
process.stderr.write("\nMigrated Jest configuration:\n"); | ||
process.stdout.write("".concat(prefix).concat(stringify(migratedConfig, undefined, ' '), "\n")); | ||
if (footNotes.length) { | ||
process.stderr.write("\n".concat(footNotes.join('\n'), "\n")); | ||
} | ||
return [2 /*return*/]; | ||
@@ -280,7 +189,3 @@ }); | ||
if (config.globals) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (config.globals['ts-jest'] && Object.keys(config.globals['ts-jest']).length === 0) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
delete config.globals['ts-jest']; | ||
} | ||
delete config.globals['ts-jest']; | ||
if (!Object.keys(config.globals).length) { | ||
@@ -303,4 +208,3 @@ delete config.globals; | ||
} | ||
if (config.preset === "ts-jest/presets/default" /* JestPresetNames.default */) | ||
config.preset = presets_1.defaults.name; | ||
delete config.preset; | ||
} | ||
@@ -307,0 +211,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any |
@@ -43,3 +43,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.processArgv = void 0; | ||
exports.processArgv = processArgv; | ||
var bs_logger_1 = require("bs-logger"); | ||
@@ -119,2 +119,1 @@ var yargs_parser_1 = __importDefault(require("yargs-parser")); | ||
} | ||
exports.processArgv = processArgv; |
import type { Config } from '@jest/types'; | ||
import type { CompilerOptions } from 'typescript'; | ||
type TsPathMapping = Exclude<CompilerOptions['paths'], undefined>; | ||
type JestPathMapping = Config.InitialOptions['moduleNameMapper']; | ||
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix, useESM }?: { | ||
prefix?: string | undefined; | ||
useESM?: boolean | undefined; | ||
export declare const pathsToModuleNameMapper: (mapping: TsPathMapping, { prefix, useESM }?: { | ||
prefix?: string; | ||
useESM?: boolean; | ||
}) => JestPathMapping; | ||
export {}; |
@@ -6,3 +6,9 @@ export declare const LINE_FEED = "\n"; | ||
export declare const JS_JSX_REGEX: RegExp; | ||
export declare const TS_TRANSFORM_PATTERN = "^.+.tsx?$"; | ||
export declare const ESM_TS_TRANSFORM_PATTERN = "^.+\\.m?tsx?$"; | ||
export declare const TS_JS_TRANSFORM_PATTERN = "^.+.[tj]sx?$"; | ||
export declare const ESM_TS_JS_TRANSFORM_PATTERN = "^.+\\.m?[tj]sx?$"; | ||
export declare const JS_TRANSFORM_PATTERN = "^.+.jsx?$"; | ||
export declare const ESM_JS_TRANSFORM_PATTERN = "^.+\\.m?jsx?$"; | ||
export declare const TS_EXT_TO_TREAT_AS_ESM: string[]; | ||
export declare const JS_EXT_TO_TREAT_AS_ESM: string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_JEST_TEST_MATCH = exports.JS_EXT_TO_TREAT_AS_ESM = exports.TS_EXT_TO_TREAT_AS_ESM = exports.JS_JSX_REGEX = exports.TS_TSX_REGEX = exports.JS_JSX_EXTENSIONS = exports.DECLARATION_TYPE_EXT = exports.LINE_FEED = void 0; | ||
exports.JEST_CONFIG_EJS_TEMPLATE = exports.DEFAULT_JEST_TEST_MATCH = exports.JS_EXT_TO_TREAT_AS_ESM = exports.TS_EXT_TO_TREAT_AS_ESM = exports.ESM_JS_TRANSFORM_PATTERN = exports.JS_TRANSFORM_PATTERN = exports.ESM_TS_JS_TRANSFORM_PATTERN = exports.TS_JS_TRANSFORM_PATTERN = exports.ESM_TS_TRANSFORM_PATTERN = exports.TS_TRANSFORM_PATTERN = exports.JS_JSX_REGEX = exports.TS_TSX_REGEX = exports.JS_JSX_EXTENSIONS = exports.DECLARATION_TYPE_EXT = exports.LINE_FEED = void 0; | ||
exports.LINE_FEED = '\n'; | ||
@@ -9,2 +9,8 @@ exports.DECLARATION_TYPE_EXT = '.d.ts'; | ||
exports.JS_JSX_REGEX = /\.[cm]?jsx?$/; | ||
exports.TS_TRANSFORM_PATTERN = '^.+.tsx?$'; | ||
exports.ESM_TS_TRANSFORM_PATTERN = '^.+\\.m?tsx?$'; | ||
exports.TS_JS_TRANSFORM_PATTERN = '^.+.[tj]sx?$'; | ||
exports.ESM_TS_JS_TRANSFORM_PATTERN = '^.+\\.m?[tj]sx?$'; | ||
exports.JS_TRANSFORM_PATTERN = '^.+.jsx?$'; | ||
exports.ESM_JS_TRANSFORM_PATTERN = '^.+\\.m?jsx?$'; | ||
// `extensionsToTreatAsEsm` will throw error with `.mjs` | ||
@@ -18,1 +24,5 @@ exports.TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx', '.mts']; | ||
exports.DEFAULT_JEST_TEST_MATCH = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)']; | ||
/** | ||
* @internal | ||
*/ | ||
exports.JEST_CONFIG_EJS_TEMPLATE = "/** @type {import('ts-jest').JestConfigWithTsJest} **/\n<%= exportKind %> {\n testEnvironment: \"<%= testEnvironment %>\",\n transform: {\n \"<%= transformPattern %>\": <%- transformValue %>,\n },\n};"; |
import { TsJestTransformer } from './legacy/ts-jest-transformer'; | ||
import type { TsJestGlobalOptions } from './types'; | ||
import type { TsJestTransformerOptions } from './types'; | ||
export * from './config'; | ||
@@ -13,4 +13,4 @@ export * from './constants'; | ||
declare const _default: { | ||
createTransformer(tsJestConfig?: TsJestGlobalOptions): TsJestTransformer; | ||
createTransformer(tsJestConfig?: TsJestTransformerOptions): TsJestTransformer; | ||
}; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.updateOutput = exports.SOURCE_MAPPING_PREFIX = void 0; | ||
exports.SOURCE_MAPPING_PREFIX = void 0; | ||
exports.updateOutput = updateOutput; | ||
var utils_1 = require("../../utils"); | ||
@@ -22,3 +23,2 @@ /** | ||
} | ||
exports.updateOutput = updateOutput; | ||
/** | ||
@@ -25,0 +25,0 @@ * Update the source map contents for improved output. |
@@ -110,4 +110,4 @@ "use strict"; | ||
exports.IGNORE_DIAGNOSTIC_CODES = [ | ||
6059, | ||
18002, | ||
6059, // "'rootDir' is expected to contain all source files." | ||
18002, // "The 'files' list in config file is empty." | ||
18003, // "No inputs were found in config file." | ||
@@ -188,3 +188,3 @@ ]; | ||
declaration: false, | ||
noEmit: false, | ||
noEmit: false, // set to true will make compiler API not emit any compiled results. | ||
// else istanbul related will be dropped | ||
@@ -195,3 +195,3 @@ removeComments: false, | ||
outFile: undefined, | ||
composite: undefined, | ||
composite: undefined, // see https://github.com/TypeStrong/ts-node/pull/657/files | ||
declarationDir: undefined, | ||
@@ -425,4 +425,9 @@ declarationMap: undefined, | ||
var moduleValue = (_c = finalOptions.module) !== null && _c !== void 0 ? _c : defaultModule; | ||
var warningModulesForEsmInterop = [ | ||
this.compilerModule.ModuleKind.CommonJS, | ||
this.compilerModule.ModuleKind.Node16, | ||
this.compilerModule.ModuleKind.NodeNext, | ||
]; | ||
if (!this.babelConfig && | ||
moduleValue !== this.compilerModule.ModuleKind.CommonJS && | ||
!warningModulesForEsmInterop.includes(moduleValue) && | ||
!(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) { | ||
@@ -429,0 +434,0 @@ result.errors.push({ |
@@ -1,6 +0,6 @@ | ||
import type { TsJestGlobalOptions } from '../types'; | ||
import type { TsJestTransformerOptions } from '../types'; | ||
import { TsJestTransformer } from './ts-jest-transformer'; | ||
declare const _default: { | ||
createTransformer: (tsJestConfig?: TsJestGlobalOptions) => TsJestTransformer; | ||
createTransformer: (tsJestConfig?: TsJestTransformerOptions) => TsJestTransformer; | ||
}; | ||
export default _default; |
@@ -5,3 +5,5 @@ "use strict"; | ||
exports.default = { | ||
createTransformer: function (tsJestConfig) { return new ts_jest_transformer_1.TsJestTransformer(tsJestConfig); }, | ||
createTransformer: function (tsJestConfig) { | ||
return new ts_jest_transformer_1.TsJestTransformer(tsJestConfig); | ||
}, | ||
}; |
@@ -5,3 +5,3 @@ import type { SyncTransformer, TransformedSource } from '@jest/transform'; | ||
export declare class TsJestTransformer implements SyncTransformer<TsJestTransformerOptions> { | ||
private readonly tsJestConfig?; | ||
private readonly transformerOptions?; | ||
private readonly _logger; | ||
@@ -12,3 +12,3 @@ protected _compiler: CompilerInstance; | ||
private _watchMode; | ||
constructor(tsJestConfig?: import("../types").TsJestGlobalOptions | undefined); | ||
constructor(transformerOptions?: TsJestTransformerOptions | undefined); | ||
private _configsFor; | ||
@@ -15,0 +15,0 @@ protected _createConfigSet(config: TsJestTransformOptions['config'] | undefined): ConfigSet; |
@@ -93,5 +93,5 @@ "use strict"; | ||
exports.CACHE_KEY_EL_SEPARATOR = '\x00'; | ||
var TsJestTransformer = exports.TsJestTransformer = /** @class */ (function () { | ||
function TsJestTransformer(tsJestConfig) { | ||
this.tsJestConfig = tsJestConfig; | ||
var TsJestTransformer = /** @class */ (function () { | ||
function TsJestTransformer(transformerOptions) { | ||
this.transformerOptions = transformerOptions; | ||
this._depGraphs = new Map(); | ||
@@ -143,8 +143,8 @@ this._watchMode = false; | ||
if ((_a = config.globals) === null || _a === void 0 ? void 0 : _a['ts-jest']) { | ||
this._logger.warn("Define `ts-jest` config under `globals` is deprecated. Please do\ntransform: {\n <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],\n}," /* Deprecations.GlobalsTsJestConfigOption */); | ||
this._logger.warn("Define `ts-jest` config under `globals` is deprecated. Please do\ntransform: {\n <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],\n},\nSee more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced" /* Deprecations.GlobalsTsJestConfigOption */); | ||
} | ||
var jestGlobalsConfig = (_b = config.globals) !== null && _b !== void 0 ? _b : {}; | ||
var tsJestGlobalsConfig = (_c = jestGlobalsConfig['ts-jest']) !== null && _c !== void 0 ? _c : {}; | ||
var migratedConfig = this.tsJestConfig | ||
? __assign(__assign({}, config), { globals: __assign(__assign({}, jestGlobalsConfig), { 'ts-jest': __assign(__assign({}, tsJestGlobalsConfig), this.tsJestConfig) }) }) : config; | ||
var migratedConfig = this.transformerOptions | ||
? __assign(__assign({}, config), { globals: __assign(__assign({}, jestGlobalsConfig), { 'ts-jest': __assign(__assign({}, tsJestGlobalsConfig), this.transformerOptions) }) }) : config; | ||
configSet = this._createConfigSet(migratedConfig); | ||
@@ -197,5 +197,5 @@ var jest_1 = __assign({}, migratedConfig); | ||
TsJestTransformer.prototype.processAsync = function (sourceText, sourcePath, transformOptions) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var configs, shouldStringifyContent, babelJest, result, processWithTsResult; | ||
var _a; | ||
return __generator(this, function (_b) { | ||
@@ -303,7 +303,6 @@ switch (_b.label) { | ||
var _a; | ||
var _b; | ||
var configs = this._configsFor(transformOptions); | ||
this._logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'computing cache key for', filePath); | ||
// we do not instrument, ensure it is false all the time | ||
var supportsStaticESM = transformOptions.supportsStaticESM, instrument = (_a = transformOptions.instrument, _a === void 0 ? false : _a); | ||
var supportsStaticESM = transformOptions.supportsStaticESM, _b = transformOptions.instrument, instrument = _b === void 0 ? false : _b; | ||
var constructingCacheKeyElements = [ | ||
@@ -324,3 +323,3 @@ this._transformCfgStr, | ||
var resolvedModuleNames = void 0; | ||
if (((_b = this._depGraphs.get(filePath)) === null || _b === void 0 ? void 0 : _b.fileContent) === fileContent) { | ||
if (((_a = this._depGraphs.get(filePath)) === null || _a === void 0 ? void 0 : _a.fileContent) === fileContent) { | ||
this._logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'getting resolved modules from disk caching or memory caching for', filePath); | ||
@@ -361,1 +360,2 @@ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
}()); | ||
exports.TsJestTransformer = TsJestTransformer; |
import type { Config } from '@jest/types'; | ||
import type { TsJestPresets } from '../types'; | ||
import { DefaultEsmLegacyPreset, DefaultEsmPreset, DefaultEsmTransformOptions, DefaultLegacyPreset, DefaultPreset, DefaultTransformOptions, JsWithBabelEsmLegacyPreset, JsWithBabelEsmPreset, JsWithBabelEsmTransformOptions, JsWithBabelLegacyPreset, JsWithBabelPreset, JsWithBabelTransformerOptions, JsWithTsEsmLegacyPreset, JsWithTsEsmPreset, JsWithTsEsmTransformOptions, JsWithTsLegacyPreset, JsWithTsPreset, JsWithTsTransformOptions, TsJestPresets } from '../types'; | ||
/** | ||
* @deprecated use other functions below instead | ||
*/ | ||
export declare function createJestPreset(legacy?: boolean, allowJs?: boolean, extraOptions?: Config.InitialOptions): TsJestPresets; | ||
export declare function createDefaultPreset(tsJestTransformOptions?: DefaultTransformOptions): DefaultPreset; | ||
export declare function createDefaultLegacyPreset(tsJestTransformOptions?: DefaultTransformOptions): DefaultLegacyPreset; | ||
export declare function createJsWithTsPreset(tsJestTransformOptions?: JsWithTsTransformOptions): JsWithTsPreset; | ||
export declare function createJsWithTsLegacyPreset(tsJestTransformOptions?: JsWithTsTransformOptions): JsWithTsLegacyPreset; | ||
export declare function createJsWithBabelPreset(tsJestTransformOptions?: JsWithBabelTransformerOptions): JsWithBabelPreset; | ||
export declare function createJsWithBabelLegacyPreset(tsJestTransformOptions?: JsWithBabelTransformerOptions): JsWithBabelLegacyPreset; | ||
export declare function createDefaultEsmPreset(tsJestTransformOptions?: DefaultEsmTransformOptions): DefaultEsmPreset; | ||
export declare function createDefaultEsmLegacyPreset(tsJestTransformOptions?: DefaultEsmTransformOptions): DefaultEsmLegacyPreset; | ||
export declare function createJsWithTsEsmPreset(tsJestTransformOptions?: JsWithTsEsmTransformOptions): JsWithTsEsmPreset; | ||
export declare function createJsWithTsEsmLegacyPreset(tsJestTransformOptions?: JsWithTsEsmTransformOptions): JsWithTsEsmLegacyPreset; | ||
export declare function createJsWithBabelEsmPreset(tsJestTransformOptions?: JsWithBabelEsmTransformOptions): JsWithBabelEsmPreset; | ||
export declare function createJsWithBabelEsmLegacyPreset(tsJestTransformOptions?: JsWithBabelEsmTransformOptions): JsWithBabelEsmLegacyPreset; |
@@ -13,6 +13,47 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createJestPreset = void 0; | ||
exports.createJestPreset = createJestPreset; | ||
exports.createDefaultPreset = createDefaultPreset; | ||
exports.createDefaultLegacyPreset = createDefaultLegacyPreset; | ||
exports.createJsWithTsPreset = createJsWithTsPreset; | ||
exports.createJsWithTsLegacyPreset = createJsWithTsLegacyPreset; | ||
exports.createJsWithBabelPreset = createJsWithBabelPreset; | ||
exports.createJsWithBabelLegacyPreset = createJsWithBabelLegacyPreset; | ||
exports.createDefaultEsmPreset = createDefaultEsmPreset; | ||
exports.createDefaultEsmLegacyPreset = createDefaultEsmLegacyPreset; | ||
exports.createJsWithTsEsmPreset = createJsWithTsEsmPreset; | ||
exports.createJsWithTsEsmLegacyPreset = createJsWithTsEsmLegacyPreset; | ||
exports.createJsWithBabelEsmPreset = createJsWithBabelEsmPreset; | ||
exports.createJsWithBabelEsmLegacyPreset = createJsWithBabelEsmLegacyPreset; | ||
var constants_1 = require("../constants"); | ||
var utils_1 = require("../utils"); | ||
var logger = utils_1.rootLogger.child({ namespace: 'jest-preset' }); | ||
/** | ||
* @deprecated use other functions below instead | ||
*/ | ||
function createJestPreset(legacy, allowJs, extraOptions) { | ||
@@ -31,2 +72,149 @@ var _a; | ||
} | ||
exports.createJestPreset = createJestPreset; | ||
function createDefaultPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating default CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.TS_TRANSFORM_PATTERN] = ['ts-jest', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createDefaultLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating default CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.TS_TRANSFORM_PATTERN] = ['ts-jest/legacy', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createJsWithTsPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating Js with Ts CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.TS_JS_TRANSFORM_PATTERN] = ['ts-jest', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createJsWithTsLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating Js with Ts CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.TS_JS_TRANSFORM_PATTERN] = ['ts-jest/legacy', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createJsWithBabelPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating JS with Babel CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.JS_TRANSFORM_PATTERN] = 'babel-jest', | ||
_a[constants_1.TS_TRANSFORM_PATTERN] = ['ts-jest', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createJsWithBabelLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating JS with Babel CJS Jest preset'); | ||
return { | ||
transform: (_a = {}, | ||
_a[constants_1.JS_TRANSFORM_PATTERN] = 'babel-jest', | ||
_a[constants_1.TS_TRANSFORM_PATTERN] = ['ts-jest/legacy', tsJestTransformOptions], | ||
_a), | ||
}; | ||
} | ||
function createDefaultEsmPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating default ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_TS_TRANSFORM_PATTERN] = [ | ||
'ts-jest', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} | ||
function createDefaultEsmLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating default ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_TS_TRANSFORM_PATTERN] = [ | ||
'ts-jest/legacy', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} | ||
function createJsWithTsEsmPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating Js with Ts ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_TS_JS_TRANSFORM_PATTERN] = [ | ||
'ts-jest', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} | ||
function createJsWithTsEsmLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating Js with Ts ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_TS_JS_TRANSFORM_PATTERN] = [ | ||
'ts-jest/legacy', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} | ||
function createJsWithBabelEsmPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating JS with Babel ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_JS_TRANSFORM_PATTERN] = 'babel-jest', | ||
_a[constants_1.ESM_TS_TRANSFORM_PATTERN] = [ | ||
'ts-jest', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} | ||
function createJsWithBabelEsmLegacyPreset(tsJestTransformOptions) { | ||
var _a; | ||
if (tsJestTransformOptions === void 0) { tsJestTransformOptions = {}; } | ||
logger.debug('creating JS with Babel ESM Jest preset'); | ||
return { | ||
extensionsToTreatAsEsm: __spreadArray(__spreadArray([], __read(constants_1.JS_EXT_TO_TREAT_AS_ESM), false), __read(constants_1.TS_EXT_TO_TREAT_AS_ESM), false), | ||
transform: (_a = {}, | ||
_a[constants_1.ESM_JS_TRANSFORM_PATTERN] = 'babel-jest', | ||
_a[constants_1.ESM_TS_TRANSFORM_PATTERN] = [ | ||
'ts-jest/legacy', | ||
__assign(__assign({}, tsJestTransformOptions), { useESM: true }), | ||
], | ||
_a), | ||
}; | ||
} |
export interface RawCompilerOptions { | ||
/** | ||
* Enable importing files with any extension, provided a declaration file is present. | ||
*/ | ||
allowArbitraryExtensions?: boolean | null; | ||
/** | ||
* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. | ||
*/ | ||
allowImportingTsExtensions?: boolean | null; | ||
/** | ||
* No longer supported. In early versions, manually set the text encoding for reading files. | ||
*/ | ||
charset?: string; | ||
charset?: string | null; | ||
/** | ||
* Enable constraints that allow a TypeScript project to be used with project references. | ||
*/ | ||
composite?: boolean; | ||
composite?: boolean | null; | ||
/** | ||
* Conditions to set in addition to the resolver-specific defaults when resolving imports. | ||
*/ | ||
customConditions?: Array<string | null> | null; | ||
/** | ||
* Generate .d.ts files from TypeScript and JavaScript files in your project. | ||
*/ | ||
declaration?: boolean; | ||
declaration?: boolean | null; | ||
/** | ||
@@ -21,35 +33,39 @@ * Specify the output directory for generated declaration files. | ||
*/ | ||
diagnostics?: boolean; | ||
diagnostics?: boolean | null; | ||
/** | ||
* Reduce the number of projects loaded automatically by TypeScript. | ||
*/ | ||
disableReferencedProjectLoad?: boolean; | ||
disableReferencedProjectLoad?: boolean | null; | ||
/** | ||
* Enforces using indexed accessors for keys declared using an indexed type | ||
*/ | ||
noPropertyAccessFromIndexSignature?: boolean; | ||
noPropertyAccessFromIndexSignature?: boolean | null; | ||
/** | ||
* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. | ||
*/ | ||
emitBOM?: boolean; | ||
emitBOM?: boolean | null; | ||
/** | ||
* Only output d.ts files and not JavaScript files. | ||
*/ | ||
emitDeclarationOnly?: boolean; | ||
emitDeclarationOnly?: boolean | null; | ||
/** | ||
* Save .tsbuildinfo files to allow for incremental compilation of projects. | ||
* Differentiate between undefined and not present when type checking | ||
*/ | ||
incremental?: boolean; | ||
exactOptionalPropertyTypes?: boolean | null; | ||
/** | ||
* Enable incremental compilation. Requires TypeScript version 3.4 or later. | ||
*/ | ||
incremental?: boolean | null; | ||
/** | ||
* Specify the folder for .tsbuildinfo incremental compilation files. | ||
*/ | ||
tsBuildInfoFile?: string; | ||
tsBuildInfoFile?: string | null; | ||
/** | ||
* Include sourcemap files inside the emitted JavaScript. | ||
*/ | ||
inlineSourceMap?: boolean; | ||
inlineSourceMap?: boolean | null; | ||
/** | ||
* Include source code in the sourcemaps inside the emitted JavaScript. | ||
*/ | ||
inlineSources?: boolean; | ||
inlineSources?: boolean | null; | ||
/** | ||
@@ -62,195 +78,223 @@ * Specify what JSX code is generated. | ||
*/ | ||
reactNamespace?: string; | ||
reactNamespace?: string | null; | ||
/** | ||
* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' | ||
*/ | ||
jsxFactory?: string; | ||
jsxFactory?: string | null; | ||
/** | ||
* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. | ||
*/ | ||
jsxFragmentFactory?: string; | ||
jsxFragmentFactory?: string | null; | ||
/** | ||
* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` | ||
* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`. | ||
*/ | ||
jsxImportSource?: string; | ||
jsxImportSource?: string | null; | ||
/** | ||
* Print all of the files read during the compilation. | ||
*/ | ||
listFiles?: boolean; | ||
listFiles?: boolean | null; | ||
/** | ||
* Specify the location where debugger should locate map files instead of generated locations. | ||
*/ | ||
mapRoot?: string; | ||
mapRoot?: string | null; | ||
/** | ||
* Specify what module code is generated. | ||
*/ | ||
module?: ('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None') | string; | ||
module?: ('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') & (((('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') | { | ||
[k: string]: unknown; | ||
}) & string) | ((('CommonJS' | 'AMD' | 'System' | 'UMD' | 'ES6' | 'ES2015' | 'ES2020' | 'ESNext' | 'None' | 'ES2022' | 'Node16' | 'NodeNext' | 'Preserve') | { | ||
[k: string]: unknown; | ||
}) & null)); | ||
/** | ||
* Specify how TypeScript looks up a file from a given module specifier. | ||
*/ | ||
moduleResolution?: ('Classic' | 'Node') | string; | ||
moduleResolution?: ('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') & (((('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') | { | ||
[k: string]: unknown; | ||
}) & string) | ((('Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler') | { | ||
[k: string]: unknown; | ||
}) & null)); | ||
/** | ||
* Set the newline character for emitting files. | ||
*/ | ||
newLine?: ('crlf' | 'lf') | string; | ||
newLine?: ('crlf' | 'lf') & (((('crlf' | 'lf') | { | ||
[k: string]: unknown; | ||
}) & string) | ((('crlf' | 'lf') | { | ||
[k: string]: unknown; | ||
}) & null)); | ||
/** | ||
* Disable emitting file from a compilation. | ||
*/ | ||
noEmit?: boolean; | ||
noEmit?: boolean | null; | ||
/** | ||
* Disable generating custom helper functions like `__extends` in compiled output. | ||
*/ | ||
noEmitHelpers?: boolean; | ||
noEmitHelpers?: boolean | null; | ||
/** | ||
* Disable emitting files if any type checking errors are reported. | ||
*/ | ||
noEmitOnError?: boolean; | ||
noEmitOnError?: boolean | null; | ||
/** | ||
* Enable error reporting for expressions and declarations with an implied `any` type.. | ||
*/ | ||
noImplicitAny?: boolean; | ||
noImplicitAny?: boolean | null; | ||
/** | ||
* Enable error reporting when `this` is given the type `any`. | ||
*/ | ||
noImplicitThis?: boolean; | ||
noImplicitThis?: boolean | null; | ||
/** | ||
* Enable error reporting when a local variables aren't read. | ||
*/ | ||
noUnusedLocals?: boolean; | ||
noUnusedLocals?: boolean | null; | ||
/** | ||
* Raise an error when a function parameter isn't read | ||
*/ | ||
noUnusedParameters?: boolean; | ||
noUnusedParameters?: boolean | null; | ||
/** | ||
* Disable including any library files, including the default lib.d.ts. | ||
*/ | ||
noLib?: boolean; | ||
noLib?: boolean | null; | ||
/** | ||
* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. | ||
*/ | ||
noResolve?: boolean; | ||
noResolve?: boolean | null; | ||
/** | ||
* Disable strict checking of generic signatures in function types. | ||
*/ | ||
noStrictGenericChecks?: boolean; | ||
noStrictGenericChecks?: boolean | null; | ||
/** | ||
* Skip type checking .d.ts files that are included with TypeScript. | ||
*/ | ||
skipDefaultLibCheck?: boolean; | ||
skipDefaultLibCheck?: boolean | null; | ||
/** | ||
* Skip type checking all .d.ts files. | ||
*/ | ||
skipLibCheck?: boolean; | ||
skipLibCheck?: boolean | null; | ||
/** | ||
* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. | ||
*/ | ||
outFile?: string; | ||
outFile?: string | null; | ||
/** | ||
* Specify an output folder for all emitted files. | ||
*/ | ||
outDir?: string; | ||
outDir?: string | null; | ||
/** | ||
* Disable erasing `const enum` declarations in generated code. | ||
*/ | ||
preserveConstEnums?: boolean; | ||
preserveConstEnums?: boolean | null; | ||
/** | ||
* Disable resolving symlinks to their realpath. This correlates to the same flag in node. | ||
*/ | ||
preserveSymlinks?: boolean; | ||
preserveSymlinks?: boolean | null; | ||
/** | ||
* Preserve unused imported values in the JavaScript output that would otherwise be removed | ||
*/ | ||
preserveValueImports?: boolean | null; | ||
/** | ||
* Disable wiping the console in watch mode | ||
*/ | ||
preserveWatchOutput?: boolean; | ||
preserveWatchOutput?: boolean | null; | ||
/** | ||
* Enable color and formatting in output to make compiler errors easier to read | ||
*/ | ||
pretty?: boolean; | ||
pretty?: boolean | null; | ||
/** | ||
* Disable emitting comments. | ||
*/ | ||
removeComments?: boolean; | ||
removeComments?: boolean | null; | ||
/** | ||
* Specify the root folder within your source files. | ||
*/ | ||
rootDir?: string; | ||
rootDir?: string | null; | ||
/** | ||
* Ensure that each file can be safely transpiled without relying on other imports. | ||
*/ | ||
isolatedModules?: boolean; | ||
isolatedModules?: boolean | null; | ||
/** | ||
* Create source map files for emitted JavaScript files. | ||
*/ | ||
sourceMap?: boolean; | ||
sourceMap?: boolean | null; | ||
/** | ||
* Specify the root path for debuggers to find the reference source code. | ||
*/ | ||
sourceRoot?: string; | ||
sourceRoot?: string | null; | ||
/** | ||
* Disable reporting of excess property errors during the creation of object literals. | ||
*/ | ||
suppressExcessPropertyErrors?: boolean; | ||
suppressExcessPropertyErrors?: boolean | null; | ||
/** | ||
* Suppress `noImplicitAny` errors when indexing objects that lack index signatures. | ||
*/ | ||
suppressImplicitAnyIndexErrors?: boolean; | ||
suppressImplicitAnyIndexErrors?: boolean | null; | ||
/** | ||
* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. | ||
*/ | ||
target?: ('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ESNext') | string; | ||
target?: ('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') & (((('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') | { | ||
[k: string]: unknown; | ||
}) & string) | ((('ES3' | 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ESNext') | { | ||
[k: string]: unknown; | ||
}) & null)); | ||
/** | ||
* Default catch clause variables as `unknown` instead of `any`. | ||
*/ | ||
useUnknownInCatchVariables?: boolean | null; | ||
/** | ||
* Watch input files. | ||
*/ | ||
watch?: boolean; | ||
watch?: boolean | null; | ||
/** | ||
* Specify what approach the watcher should use if the system runs out of native file watchers. | ||
* Specify the polling strategy to use when the system runs out of or doesn't support native file watchers. Requires TypeScript version 3.8 or later. | ||
*/ | ||
fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling'; | ||
fallbackPolling?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'fixedInterval' | 'priorityInterval' | 'dynamicPriority' | 'fixedChunkSize'; | ||
/** | ||
* Specify how directories are watched on systems that lack recursive file-watching functionality. | ||
* Specify the strategy for watching directories under systems that lack recursive file-watching functionality. Requires TypeScript version 3.8 or later. | ||
*/ | ||
watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling'; | ||
watchDirectory?: 'useFsEvents' | 'fixedPollingInterval' | 'dynamicPriorityPolling' | 'fixedChunkSizePolling'; | ||
/** | ||
* Specify how the TypeScript watch mode works. | ||
* Specify the strategy for watching individual files. Requires TypeScript version 3.8 or later. | ||
*/ | ||
watchFile?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'useFsEvents' | 'useFsEventsOnParentDirectory'; | ||
watchFile?: 'fixedPollingInterval' | 'priorityPollingInterval' | 'dynamicPriorityPolling' | 'useFsEvents' | 'useFsEventsOnParentDirectory' | 'fixedChunkSizePolling'; | ||
/** | ||
* Enable experimental support for TC39 stage 2 draft decorators. | ||
*/ | ||
experimentalDecorators?: boolean; | ||
experimentalDecorators?: boolean | null; | ||
/** | ||
* Emit design-type metadata for decorated declarations in source files. | ||
*/ | ||
emitDecoratorMetadata?: boolean; | ||
emitDecoratorMetadata?: boolean | null; | ||
/** | ||
* Disable error reporting for unused labels. | ||
*/ | ||
allowUnusedLabels?: boolean; | ||
allowUnusedLabels?: boolean | null; | ||
/** | ||
* Enable error reporting for codepaths that do not explicitly return in a function. | ||
*/ | ||
noImplicitReturns?: boolean; | ||
noImplicitReturns?: boolean | null; | ||
/** | ||
* Add `undefined` to a type when accessed using an index. | ||
*/ | ||
noUncheckedIndexedAccess?: boolean; | ||
noUncheckedIndexedAccess?: boolean | null; | ||
/** | ||
* Enable error reporting for fallthrough cases in switch statements. | ||
*/ | ||
noFallthroughCasesInSwitch?: boolean; | ||
noFallthroughCasesInSwitch?: boolean | null; | ||
/** | ||
* Ensure overriding members in derived classes are marked with an override modifier. | ||
*/ | ||
noImplicitOverride?: boolean | null; | ||
/** | ||
* Disable error reporting for unreachable code. | ||
*/ | ||
allowUnreachableCode?: boolean; | ||
allowUnreachableCode?: boolean | null; | ||
/** | ||
* Ensure that casing is correct in imports. | ||
*/ | ||
forceConsistentCasingInFileNames?: boolean; | ||
forceConsistentCasingInFileNames?: boolean | null; | ||
/** | ||
* Emit a v8 CPU profile of the compiler run for debugging. | ||
*/ | ||
generateCpuProfile?: string; | ||
generateCpuProfile?: string | null; | ||
/** | ||
* Specify the base directory to resolve non-relative module names. | ||
*/ | ||
baseUrl?: string; | ||
baseUrl?: string | null; | ||
/** | ||
@@ -260,4 +304,4 @@ * Specify a set of entries that re-map imports to additional lookup locations. | ||
paths?: { | ||
[k: string]: string[]; | ||
}; | ||
[k: string]: Array<string | null> | null; | ||
} | null; | ||
/** | ||
@@ -270,61 +314,155 @@ * Specify a list of language service plugins to include. | ||
*/ | ||
name?: string; | ||
name?: string | null; | ||
[k: string]: unknown; | ||
}>; | ||
} | null> | null; | ||
/** | ||
* Allow multiple folders to be treated as one when resolving modules. | ||
*/ | ||
rootDirs?: string[]; | ||
rootDirs?: Array<string | null> | null; | ||
/** | ||
* Specify multiple folders that act like `./node_modules/@types`. | ||
*/ | ||
typeRoots?: string[]; | ||
typeRoots?: Array<string | null> | null; | ||
/** | ||
* Specify type package names to be included without being referenced in a source file. | ||
*/ | ||
types?: string[]; | ||
types?: Array<string | null> | null; | ||
/** | ||
* Log paths used during the `moduleResolution` process. | ||
* Enable tracing of the name resolution process. Requires TypeScript version 2.0 or later. | ||
*/ | ||
traceResolution?: boolean; | ||
traceResolution?: boolean | null; | ||
/** | ||
* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. | ||
*/ | ||
allowJs?: boolean; | ||
allowJs?: boolean | null; | ||
/** | ||
* Disable truncating types in error messages. | ||
*/ | ||
noErrorTruncation?: boolean; | ||
noErrorTruncation?: boolean | null; | ||
/** | ||
* Allow 'import x from y' when a module doesn't have a default export. | ||
*/ | ||
allowSyntheticDefaultImports?: boolean; | ||
allowSyntheticDefaultImports?: boolean | null; | ||
/** | ||
* Disable adding 'use strict' directives in emitted JavaScript files. | ||
*/ | ||
noImplicitUseStrict?: boolean; | ||
noImplicitUseStrict?: boolean | null; | ||
/** | ||
* Print the names of emitted files after a compilation. | ||
*/ | ||
listEmittedFiles?: boolean; | ||
listEmittedFiles?: boolean | null; | ||
/** | ||
* Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server. | ||
*/ | ||
disableSizeLimit?: boolean; | ||
disableSizeLimit?: boolean | null; | ||
/** | ||
* Specify a set of bundled library declaration files that describe the target runtime environment. | ||
*/ | ||
lib?: Array<('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') | string>; | ||
lib?: Array<(('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
}) & (((('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
}) & string) | ((('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.Intl' | '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.AsyncIterable' | 'DOM.Iterable' | 'ScriptHost' | 'WebWorker' | 'WebWorker.AsyncIterable' | 'WebWorker.ImportScripts' | 'Webworker.Iterable' | 'ES7' | 'ES2021' | 'ES2020.SharedMemory' | 'ES2020.Intl' | 'ES2020.Date' | 'ES2020.Number' | 'ES2021.Promise' | 'ES2021.String' | 'ES2021.WeakRef' | 'ESNext.WeakRef' | 'ES2021.Intl' | 'ES2022' | 'ES2022.Array' | 'ES2022.Error' | 'ES2022.Intl' | 'ES2022.Object' | 'ES2022.String' | 'ES2022.SharedMemory' | 'ES2022.RegExp' | 'ES2023' | 'ES2023.Array' | 'Decorators' | 'Decorators.Legacy' | 'ES2017.Date' | 'ES2023.Collection' | 'ESNext.Decorators' | 'ESNext.Disposable') | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
} | { | ||
[k: string]: unknown; | ||
}) & null))> | null; | ||
/** | ||
* Specify how TypeScript determine a file as module. | ||
*/ | ||
moduleDetection?: 'auto' | 'legacy' | 'force'; | ||
/** | ||
* When type checking, take into account `null` and `undefined`. | ||
*/ | ||
strictNullChecks?: boolean; | ||
strictNullChecks?: boolean | null; | ||
/** | ||
* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. | ||
*/ | ||
maxNodeModuleJsDepth?: number; | ||
maxNodeModuleJsDepth?: number | null; | ||
/** | ||
* Allow importing helper functions from tslib once per project, instead of including them per-file. | ||
*/ | ||
importHelpers?: boolean; | ||
importHelpers?: boolean | null; | ||
/** | ||
@@ -337,72 +475,84 @@ * Specify emit/checking behavior for imports that are only used for types. | ||
*/ | ||
alwaysStrict?: boolean; | ||
alwaysStrict?: boolean | null; | ||
/** | ||
* Enable all strict type checking options. | ||
*/ | ||
strict?: boolean; | ||
strict?: boolean | null; | ||
/** | ||
* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. | ||
*/ | ||
strictBindCallApply?: boolean; | ||
strictBindCallApply?: boolean | null; | ||
/** | ||
* Emit more compliant, but verbose and less performant JavaScript for iteration. | ||
*/ | ||
downlevelIteration?: boolean; | ||
downlevelIteration?: boolean | null; | ||
/** | ||
* Enable error reporting in type-checked JavaScript files. | ||
*/ | ||
checkJs?: boolean; | ||
checkJs?: boolean | null; | ||
/** | ||
* When assigning functions, check to ensure parameters and the return values are subtype-compatible. | ||
*/ | ||
strictFunctionTypes?: boolean; | ||
strictFunctionTypes?: boolean | null; | ||
/** | ||
* Check for class properties that are declared but not set in the constructor. | ||
*/ | ||
strictPropertyInitialization?: boolean; | ||
strictPropertyInitialization?: boolean | null; | ||
/** | ||
* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. | ||
*/ | ||
esModuleInterop?: boolean; | ||
esModuleInterop?: boolean | null; | ||
/** | ||
* Allow accessing UMD globals from modules. | ||
*/ | ||
allowUmdGlobalAccess?: boolean; | ||
allowUmdGlobalAccess?: boolean | null; | ||
/** | ||
* Make keyof only return strings instead of string, numbers or symbols. Legacy option. | ||
*/ | ||
keyofStringsOnly?: boolean; | ||
keyofStringsOnly?: boolean | null; | ||
/** | ||
* Emit ECMAScript-standard-compliant class fields. | ||
*/ | ||
useDefineForClassFields?: boolean; | ||
useDefineForClassFields?: boolean | null; | ||
/** | ||
* Create sourcemaps for d.ts files. | ||
*/ | ||
declarationMap?: boolean; | ||
declarationMap?: boolean | null; | ||
/** | ||
* Enable importing .json files | ||
*/ | ||
resolveJsonModule?: boolean; | ||
resolveJsonModule?: boolean | null; | ||
/** | ||
* Have recompiles in projects that use `incremental` and `watch` mode assume that changes within a file will only affect files directly depending on it. | ||
* Use the package.json 'exports' field when resolving package imports. | ||
*/ | ||
assumeChangesOnlyAffectDirectDependencies?: boolean; | ||
resolvePackageJsonExports?: boolean | null; | ||
/** | ||
* Use the package.json 'imports' field when resolving imports. | ||
*/ | ||
resolvePackageJsonImports?: boolean | null; | ||
/** | ||
* Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later. | ||
*/ | ||
assumeChangesOnlyAffectDirectDependencies?: boolean | null; | ||
/** | ||
* Output more detailed compiler performance information after building. | ||
*/ | ||
extendedDiagnostics?: boolean; | ||
extendedDiagnostics?: boolean | null; | ||
/** | ||
* Print names of files that are part of the compilation and then stop processing. | ||
*/ | ||
listFilesOnly?: boolean; | ||
listFilesOnly?: boolean | null; | ||
/** | ||
* Disable preferring source files instead of declaration files when referencing composite projects | ||
*/ | ||
disableSourceOfProjectReferenceRedirect?: boolean; | ||
disableSourceOfProjectReferenceRedirect?: boolean | null; | ||
/** | ||
* Opt a project out of multi-project reference checking when editing. | ||
*/ | ||
disableSolutionSearching?: boolean; | ||
disableSolutionSearching?: boolean | null; | ||
/** | ||
* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. | ||
*/ | ||
verbatimModuleSyntax?: boolean | null; | ||
[k: string]: unknown; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.factory = exports.name = exports.version = void 0; | ||
exports.name = exports.version = void 0; | ||
exports.factory = factory; | ||
var bs_logger_1 = require("bs-logger"); | ||
@@ -124,2 +125,1 @@ /** | ||
} | ||
exports.factory = factory; |
@@ -5,15 +5,5 @@ import type { TransformedSource, TransformOptions } from '@jest/transform'; | ||
import type * as _ts from 'typescript'; | ||
import { ESM_JS_TRANSFORM_PATTERN, ESM_TS_JS_TRANSFORM_PATTERN, ESM_TS_TRANSFORM_PATTERN, JS_TRANSFORM_PATTERN, TS_JS_TRANSFORM_PATTERN, TS_TRANSFORM_PATTERN } from './constants'; | ||
import type { ConfigSet } from './legacy/config/config-set'; | ||
import type { RawCompilerOptions } from './raw-compiler-options'; | ||
declare module '@jest/types' { | ||
namespace Config { | ||
interface ConfigGlobals { | ||
/** | ||
* strangely `@ts-expect-error` doesn't work in this case when running | ||
* `npm run build` vs `npm run pretest` | ||
*/ | ||
'ts-jest'?: TsJestGlobalOptions; | ||
} | ||
} | ||
} | ||
export type TTypeScript = typeof _ts; | ||
@@ -152,3 +142,2 @@ /** | ||
} | ||
export type TsJestPresets = Pick<JestConfigWithTsJest, 'extensionsToTreatAsEsm' | 'moduleFileExtensions' | 'transform' | 'testMatch'>; | ||
export type StringMap = Map<string, string>; | ||
@@ -186,1 +175,104 @@ export interface DepGraphInfo { | ||
} | ||
/** | ||
* @deprecated use other preset types below instead | ||
*/ | ||
export type TsJestPresets = Pick<JestConfigWithTsJest, 'extensionsToTreatAsEsm' | 'moduleFileExtensions' | 'transform' | 'testMatch'>; | ||
export type DefaultTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type DefaultPreset = { | ||
transform: { | ||
[TS_TRANSFORM_PATTERN]: ['ts-jest', DefaultTransformOptions]; | ||
}; | ||
}; | ||
export type DefaultLegacyPreset = { | ||
transform: { | ||
[TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', DefaultTransformOptions]; | ||
}; | ||
}; | ||
export type DefaultEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type DefaultEsmPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest', { | ||
useESM: true; | ||
} & DefaultEsmTransformOptions]; | ||
}; | ||
}; | ||
export type DefaultEsmLegacyPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', { | ||
useESM: true; | ||
} & DefaultEsmTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithTsTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type JsWithTsPreset = { | ||
transform: { | ||
[TS_JS_TRANSFORM_PATTERN]: ['ts-jest', JsWithTsTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithTsLegacyPreset = { | ||
transform: { | ||
[TS_JS_TRANSFORM_PATTERN]: ['ts-jest/legacy', JsWithTsTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithTsEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type JsWithTsEsmPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_TS_JS_TRANSFORM_PATTERN]: ['ts-jest', { | ||
useESM: true; | ||
} & JsWithTsEsmTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithTsEsmLegacyPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_TS_JS_TRANSFORM_PATTERN]: ['ts-jest/legacy', { | ||
useESM: true; | ||
} & JsWithTsEsmTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithBabelTransformerOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type JsWithBabelPreset = { | ||
transform: { | ||
[JS_TRANSFORM_PATTERN]: 'babel-jest'; | ||
[TS_TRANSFORM_PATTERN]: ['ts-jest', JsWithBabelTransformerOptions]; | ||
}; | ||
}; | ||
export type JsWithBabelLegacyPreset = { | ||
transform: { | ||
[JS_TRANSFORM_PATTERN]: 'babel-jest'; | ||
[TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', JsWithBabelTransformerOptions]; | ||
}; | ||
}; | ||
export type JsWithBabelEsmTransformOptions = Omit<TsJestTransformerOptions, 'useESM'>; | ||
export type JsWithBabelEsmPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_JS_TRANSFORM_PATTERN]: 'babel-jest'; | ||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest', { | ||
useESM: true; | ||
} & JsWithBabelEsmTransformOptions]; | ||
}; | ||
}; | ||
export type JsWithBabelEsmLegacyPreset = { | ||
extensionsToTreatAsEsm: string[]; | ||
transform: { | ||
[ESM_JS_TRANSFORM_PATTERN]: 'babel-jest'; | ||
[ESM_TS_TRANSFORM_PATTERN]: ['ts-jest/legacy', { | ||
useESM: true; | ||
} & JsWithBabelEsmTransformOptions]; | ||
}; | ||
}; | ||
declare module '@jest/types' { | ||
namespace Config { | ||
interface ConfigGlobals { | ||
/** | ||
* strangely `@ts-expect-error` doesn't work in this case when running | ||
* `npm run build` vs `npm run pretest` | ||
*/ | ||
'ts-jest'?: TsJestTransformerOptions; | ||
} | ||
} | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("./constants"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPackageVersion = void 0; | ||
exports.getPackageVersion = getPackageVersion; | ||
/** | ||
@@ -14,2 +14,1 @@ * @internal | ||
} | ||
exports.getPackageVersion = getPackageVersion; |
@@ -45,3 +45,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.__requireModule = exports.importer = exports.Importer = void 0; | ||
exports.importer = exports.Importer = void 0; | ||
exports.__requireModule = __requireModule; | ||
var logger_1 = require("./logger"); | ||
@@ -60,3 +61,3 @@ var memoize_1 = require("./memoize"); | ||
*/ | ||
var Importer = exports.Importer = /** @class */ (function () { | ||
var Importer = /** @class */ (function () { | ||
function Importer(_patches) { | ||
@@ -194,2 +195,3 @@ if (_patches === void 0) { _patches = {}; } | ||
}()); | ||
exports.Importer = Importer; | ||
/** | ||
@@ -233,2 +235,1 @@ * @internal | ||
} | ||
exports.__requireModule = __requireModule; |
@@ -6,3 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalize = exports.parse = exports.stringify = void 0; | ||
exports.stringify = stringify; | ||
exports.parse = parse; | ||
exports.normalize = normalize; | ||
/* eslint-disable no-redeclare */ | ||
@@ -14,3 +16,2 @@ var fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify")); | ||
} | ||
exports.stringify = stringify; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -20,3 +21,2 @@ function parse(input) { | ||
} | ||
exports.parse = parse; | ||
/** | ||
@@ -40,3 +40,2 @@ * @internal | ||
} | ||
exports.normalize = normalize; | ||
/** | ||
@@ -43,0 +42,0 @@ * @internal |
@@ -1,1 +0,1 @@ | ||
export declare let rootLogger: import("bs-logger/dist/logger").Logger; | ||
export declare let rootLogger: import("bs-logger").Logger; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Memoize = void 0; | ||
exports.Memoize = Memoize; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -22,3 +22,2 @@ var cacheProp = Symbol.for('[memoize]'); | ||
} | ||
exports.Memoize = Memoize; | ||
// See https://github.com/microsoft/TypeScript/issues/1863#issuecomment-579541944 | ||
@@ -25,0 +24,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.interpolate = void 0; | ||
exports.interpolate = interpolate; | ||
/** | ||
@@ -13,2 +13,1 @@ * @internal | ||
} | ||
exports.interpolate = interpolate; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizeSlashes = void 0; | ||
exports.normalizeSlashes = normalizeSlashes; | ||
/** | ||
@@ -10,2 +10,1 @@ * @internal | ||
} | ||
exports.normalizeSlashes = normalizeSlashes; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sha1 = exports.cache = void 0; | ||
exports.cache = void 0; | ||
exports.sha1 = sha1; | ||
var crypto_1 = require("crypto"); | ||
@@ -42,2 +43,1 @@ /** | ||
} | ||
exports.sha1 = sha1; |
{ | ||
"name": "ts-jest", | ||
"version": "29.1.5", | ||
"version": "29.2.0", | ||
"main": "dist/index.js", | ||
@@ -14,3 +14,3 @@ "types": "dist/index.d.ts", | ||
"postbuild": "node scripts/post-build.js", | ||
"pretest": "tsc -p tsconfig.spec.json --noEmit && node scripts/prepare-test.js", | ||
"pretest": "tsc -p tsconfig.spec.json --noEmit && node scripts/create-bundle.js", | ||
"test": "jest", | ||
@@ -97,4 +97,4 @@ "test-examples": "node scripts/test-examples.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-angular": "^19.3.0", | ||
"@commitlint/cli": "18.6.1", | ||
"@commitlint/config-angular": "18.6.1", | ||
"@jest/transform": "^29.7.0", | ||
@@ -104,2 +104,3 @@ "@jest/types": "^29.6.3", | ||
"@types/cross-spawn": "latest", | ||
"@types/ejs": "^3.1.5", | ||
"@types/fs-extra": "latest", | ||
@@ -110,4 +111,4 @@ "@types/js-yaml": "latest", | ||
"@types/lodash.set": "4.3.9", | ||
"@types/micromatch": "4.0.7", | ||
"@types/node": "20.14.2", | ||
"@types/micromatch": "4.0.9", | ||
"@types/node": "20.14.10", | ||
"@types/react": "18.x", | ||
@@ -117,7 +118,8 @@ "@types/semver": "latest", | ||
"@types/yargs-parser": "21.0.3", | ||
"@typescript-eslint/eslint-plugin": "^7.13.0", | ||
"@typescript-eslint/parser": "^7.13.0", | ||
"@typescript-eslint/eslint-plugin": "^7.15.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"babel-jest": "^29.7.0", | ||
"conventional-changelog-cli": "^5.0.0", | ||
"cross-spawn": "latest", | ||
"ejs": "^3.1.10", | ||
"esbuild": "~0.21.5", | ||
@@ -128,5 +130,5 @@ "eslint": "^8.57.0", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-jsdoc": "^48.2.12", | ||
"eslint-plugin-jsdoc": "^48.5.2", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"execa": "5.1.1", | ||
@@ -142,7 +144,4 @@ "fs-extra": "11.2.0", | ||
"lint-staged": "latest", | ||
"lodash.camelcase": "^4.3.0", | ||
"lodash.set": "^4.3.2", | ||
"node-fetch": "^3.3.2", | ||
"prettier": "^3.3.2", | ||
"typescript": "~5.1.3" | ||
"prettier": "^2.8.8", | ||
"typescript": "~5.5.3" | ||
}, | ||
@@ -149,0 +148,0 @@ "lint-staged": { |
@@ -1,63 +0,53 @@ | ||
const { JS_EXT_TO_TREAT_AS_ESM, TS_EXT_TO_TREAT_AS_ESM } = require('../dist/constants') | ||
const { createJestPreset } = require('../dist/presets/create-jest-preset') | ||
const { | ||
createDefaultPreset, | ||
createDefaultEsmPreset, | ||
createJsWithTsPreset, | ||
createJsWithTsEsmPreset, | ||
createJsWithBabelPreset, | ||
createJsWithBabelEsmPreset, | ||
createDefaultLegacyPreset, | ||
createDefaultEsmLegacyPreset, | ||
createJsWithTsLegacyPreset, | ||
createJsWithTsEsmLegacyPreset, | ||
createJsWithBabelLegacyPreset, | ||
createJsWithBabelEsmLegacyPreset, | ||
} = require('../dist/presets/create-jest-preset') | ||
module.exports = { | ||
get defaults() { | ||
return createJestPreset() | ||
return createDefaultPreset() | ||
}, | ||
get defaultsLegacy() { | ||
return createJestPreset(true, false) | ||
return createDefaultLegacyPreset() | ||
}, | ||
get defaultsESM() { | ||
return createJestPreset(false, false, { extensionsToTreatAsEsm: TS_EXT_TO_TREAT_AS_ESM }) | ||
return createDefaultEsmPreset() | ||
}, | ||
get defaultsESMLegacy() { | ||
return createJestPreset(true, false, { extensionsToTreatAsEsm: TS_EXT_TO_TREAT_AS_ESM }) | ||
return createDefaultEsmLegacyPreset() | ||
}, | ||
get jsWithTs() { | ||
return createJestPreset(false, true) | ||
return createJsWithTsPreset() | ||
}, | ||
get jsWithTsLegacy() { | ||
return createJestPreset(true, true) | ||
return createJsWithTsLegacyPreset() | ||
}, | ||
get jsWithTsESM() { | ||
return createJestPreset(false, true, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
}) | ||
return createJsWithTsEsmPreset() | ||
}, | ||
get jsWithTsESMLegacy() { | ||
return createJestPreset(true, true, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
}) | ||
return createJsWithTsEsmLegacyPreset() | ||
}, | ||
get jsWithBabel() { | ||
return createJestPreset(false, false, { | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelPreset() | ||
}, | ||
get jsWithBabelLegacy() { | ||
return createJestPreset(true, false, { | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelLegacyPreset() | ||
}, | ||
get jsWithBabelESM() { | ||
return createJestPreset(false, false, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
transform: { | ||
'^.+\\.m?[j]sx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelEsmPreset() | ||
}, | ||
get jsWithBabelESMLegacy() { | ||
return createJestPreset(true, false, { | ||
extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], | ||
transform: { | ||
'^.+\\.m?[j]sx?$': 'babel-jest', | ||
}, | ||
}) | ||
return createJsWithBabelEsmLegacyPreset() | ||
}, | ||
} |
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
326262
44
4452