Comparing version 26.4.4 to 26.5.0
@@ -0,1 +1,15 @@ | ||
# [26.5.0](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.4.4) (2021-01-29) | ||
### Bug Fixes | ||
* reduce size of `node_modules` when adding `ts-jest` ([#2309](https://github.com/kulshekhar/ts-jest/issues/2309)) ([6bf2e8a](https://github.com/kulshekhar/ts-jest/commit/b8d5d2090567f23947d9efd87f5f869b16bf2e8a)) | ||
### Features | ||
* introduce `exclude` to exclude files from diagnostics ([#2308](https://github.com/kulshekhar/ts-jest/issues/2308)) ([cd82fd3](https://github.com/kulshekhar/ts-jest/commit/0c555c250774a7fd9e356cf20a3d8b693cd82fd3)) | ||
## [26.4.4](https://github.com/kulshekhar/ts-jest/compare/v26.4.3...v26.4.4) (2020-11-08) | ||
@@ -2,0 +16,0 @@ |
@@ -57,4 +57,5 @@ "use strict"; | ||
var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, base, tsJestConf, content; | ||
return __generator(this, function (_b) { | ||
file = args._[0] || 'jest.config.js'; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
file = (_c = (_b = args._[0]) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : 'jest.config.js'; | ||
filePath = path_1.join(process.cwd(), file); | ||
@@ -61,0 +62,0 @@ name = path_1.basename(file); |
@@ -69,5 +69,6 @@ "use strict"; | ||
var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix; | ||
return __generator(this, function (_a) { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
nullLogger = bs_logger_1.createLogger({ targets: [] }); | ||
file = args._[0]; | ||
file = (_a = args._[0]) === null || _a === void 0 ? void 0 : _a.toString(); | ||
filePath = path_1.resolve(process.cwd(), file); | ||
@@ -74,0 +75,0 @@ footNotes = []; |
@@ -74,3 +74,3 @@ "use strict"; | ||
var path_1 = require("path"); | ||
var memoize = require("lodash.memoize"); | ||
var memoize = require("lodash/memoize"); | ||
var mkdirp = require("mkdirp"); | ||
@@ -77,0 +77,0 @@ var constants_1 = require("../constants"); |
@@ -6,2 +6,4 @@ import type { Config } from '@jest/types'; | ||
export declare class ConfigSet { | ||
private readonly jestConfig; | ||
private readonly parentLogger?; | ||
readonly logger: Logger; | ||
@@ -19,3 +21,3 @@ readonly compilerModule: TTypeScript; | ||
get tsJestDigest(): string; | ||
get isTestFile(): (fileName: string) => boolean; | ||
isTestFile(fileName: string): boolean; | ||
shouldStringifyContent(filePath: string): boolean; | ||
@@ -22,0 +24,0 @@ raiseDiagnostics(diagnostics: Diagnostic[], filePath?: string, logger?: Logger): void; |
@@ -120,4 +120,4 @@ "use strict"; | ||
function ConfigSet(jestConfig, parentLogger) { | ||
var _a; | ||
var _b, _c, _d, _e; | ||
var _a, _b; | ||
var _c, _d, _e, _f; | ||
this.jestConfig = jestConfig; | ||
@@ -145,8 +145,8 @@ this.parentLogger = parentLogger; | ||
: logger_1.rootLogger.child({ namespace: 'config' }); | ||
this.cwd = path_1.normalize((_b = this.jestConfig.cwd) !== null && _b !== void 0 ? _b : process.cwd()); | ||
this.rootDir = path_1.normalize((_c = this.jestConfig.rootDir) !== null && _c !== void 0 ? _c : this.cwd); | ||
this.cwd = path_1.normalize((_c = this.jestConfig.cwd) !== null && _c !== void 0 ? _c : process.cwd()); | ||
this.rootDir = path_1.normalize((_d = this.jestConfig.rootDir) !== null && _d !== void 0 ? _d : this.cwd); | ||
var tsJestCfg = this.jestConfig.globals && this.jestConfig.globals['ts-jest']; | ||
var options = tsJestCfg !== null && tsJestCfg !== void 0 ? tsJestCfg : Object.create(null); | ||
this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", (_d = options.compiler) !== null && _d !== void 0 ? _d : 'typescript'); | ||
this.isolatedModules = (_e = options.isolatedModules) !== null && _e !== void 0 ? _e : false; | ||
this.compilerModule = importer_1.importer.typescript("Using \"ts-jest\" requires this package to be installed.", (_e = options.compiler) !== null && _e !== void 0 ? _e : 'typescript'); | ||
this.isolatedModules = (_f = options.isolatedModules) !== null && _f !== void 0 ? _f : false; | ||
this.logger.debug({ compilerModule: this.compilerModule }, 'normalized compiler module config via ts-jest option'); | ||
@@ -156,2 +156,9 @@ this._backportJestCfg(); | ||
this._resolveTsCacheDir(); | ||
this._matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) { | ||
return pattern instanceof RegExp || typeof pattern === 'string'; | ||
}); | ||
if (!this._matchablePatterns.length) { | ||
(_b = this._matchablePatterns).push.apply(_b, __spread(constants_1.DEFAULT_JEST_TEST_MATCH)); | ||
} | ||
this._matchTestFilePath = jest_util_1.globsToMatcher(this._matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; })); | ||
} | ||
@@ -165,3 +172,3 @@ ConfigSet.prototype._backportJestCfg = function () { | ||
var _this = this; | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
if (options.packageJson) { | ||
@@ -210,6 +217,10 @@ this.logger.warn("The option `packageJson` is deprecated and will be removed in ts-jest 27. This option is not used by internal `ts-jest`"); | ||
pretty: (_b = diagnosticsOpt.pretty) !== null && _b !== void 0 ? _b : true, | ||
exclude: (_c = diagnosticsOpt.exclude) !== null && _c !== void 0 ? _c : [], | ||
ignoreCodes: toDiagnosticCodeList(ignoreList), | ||
pathRegex: normalizeRegex(diagnosticsOpt.pathRegex), | ||
throws: !diagnosticsOpt.warnOnly, | ||
}; | ||
if (diagnosticsOpt.pathRegex) { | ||
this.logger.warn("The option `pathRegex` is deprecated and will be removed in ts-jest 27, use `exclude` instead"); | ||
this._diagnostics = __assign(__assign({}, this._diagnostics), { pathRegex: normalizeRegex(diagnosticsOpt.pathRegex) }); | ||
} | ||
} | ||
@@ -219,2 +230,3 @@ else { | ||
ignoreCodes: diagnosticsOpt ? toDiagnosticCodeList(ignoreList) : [], | ||
exclude: [], | ||
pretty: true, | ||
@@ -224,2 +236,10 @@ throws: diagnosticsOpt, | ||
} | ||
if (this._diagnostics.pathRegex && !this._diagnostics.exclude.length) { | ||
this._shouldGetDiagnosticsForFile = new RegExp(this._diagnostics.pathRegex); | ||
} | ||
else { | ||
this._shouldGetDiagnosticsForFile = this._diagnostics.exclude.length | ||
? jest_util_1.globsToMatcher(this._diagnostics.exclude) | ||
: function () { return true; }; | ||
} | ||
this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-jest option'); | ||
@@ -229,3 +249,3 @@ if (options.tsConfig) { | ||
} | ||
var tsconfigOpt = (_c = options.tsConfig) !== null && _c !== void 0 ? _c : options.tsconfig; | ||
var tsconfigOpt = (_d = options.tsConfig) !== null && _d !== void 0 ? _d : options.tsconfig; | ||
var configFilePath = typeof tsconfigOpt === 'string' ? this.resolvePath(tsconfigOpt) : undefined; | ||
@@ -422,19 +442,8 @@ this.parsedTsConfig = this._resolveTsConfig(typeof tsconfigOpt === 'object' ? tsconfigOpt : undefined, configFilePath); | ||
}); | ||
Object.defineProperty(ConfigSet.prototype, "isTestFile", { | ||
get: function () { | ||
var matchablePatterns = __spread(this._jestCfg.testMatch, this._jestCfg.testRegex).filter(function (pattern) { | ||
return pattern instanceof RegExp || typeof pattern === 'string'; | ||
}); | ||
if (!matchablePatterns.length) { | ||
matchablePatterns.push.apply(matchablePatterns, __spread(constants_1.DEFAULT_JEST_TEST_MATCH)); | ||
} | ||
var stringPatterns = matchablePatterns.filter(function (pattern) { return typeof pattern === 'string'; }); | ||
var isMatch = jest_util_1.globsToMatcher(stringPatterns); | ||
return function (fileName) { | ||
return matchablePatterns.some(function (pattern) { return (typeof pattern === 'string' ? isMatch(fileName) : pattern.test(fileName)); }); | ||
}; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
ConfigSet.prototype.isTestFile = function (fileName) { | ||
var _this = this; | ||
return this._matchablePatterns.some(function (pattern) { | ||
return typeof pattern === 'string' ? _this._matchTestFilePath(fileName) : pattern.test(fileName); | ||
}); | ||
}; | ||
ConfigSet.prototype.shouldStringifyContent = function (filePath) { | ||
@@ -466,10 +475,5 @@ return this._stringifyContentRegExp ? this._stringifyContentRegExp.test(filePath) : false; | ||
ConfigSet.prototype.shouldReportDiagnostics = function (filePath) { | ||
var pathRegex = this._diagnostics.pathRegex; | ||
if (pathRegex) { | ||
var regex = new RegExp(pathRegex); | ||
return regex.test(filePath); | ||
} | ||
else { | ||
return true; | ||
} | ||
return this._shouldGetDiagnosticsForFile instanceof RegExp | ||
? this._shouldGetDiagnosticsForFile.test(filePath) | ||
: this._shouldGetDiagnosticsForFile(filePath); | ||
}; | ||
@@ -531,7 +535,4 @@ ConfigSet.prototype._createTsError = function (diagnostics) { | ||
], ConfigSet.prototype, "hooks", null); | ||
__decorate([ | ||
memoize_1.Memoize() | ||
], ConfigSet.prototype, "isTestFile", null); | ||
return ConfigSet; | ||
}()); | ||
exports.ConfigSet = ConfigSet; |
@@ -0,1 +1,2 @@ | ||
import type { Config } from '@jest/types'; | ||
import type * as _babel from 'babel__core'; | ||
@@ -25,2 +26,3 @@ import type * as _ts from 'typescript'; | ||
pathRegex?: RegExp | string; | ||
exclude?: Config.Glob[]; | ||
warnOnly?: boolean; | ||
@@ -35,2 +37,3 @@ }; | ||
pathRegex?: string | undefined; | ||
exclude: Config.Glob[]; | ||
throws: boolean; | ||
@@ -37,0 +40,0 @@ warnOnly?: boolean; |
{ | ||
"name": "ts-jest", | ||
"version": "26.4.4", | ||
"version": "26.5.0", | ||
"main": "dist/index.js", | ||
@@ -66,3 +66,3 @@ "types": "dist/index.d.ts", | ||
"json5": "2.x", | ||
"lodash.memoize": "4.x", | ||
"lodash": "4.x", | ||
"make-error": "1.x", | ||
@@ -95,5 +95,3 @@ "mkdirp": "1.x", | ||
"@types/json5": "latest", | ||
"@types/lodash.memoize": "4.x", | ||
"@types/lodash.merge": "4.x", | ||
"@types/lodash.set": "4.x", | ||
"@types/lodash": "4.x", | ||
"@types/micromatch": "4.x", | ||
@@ -122,4 +120,2 @@ "@types/mkdirp": "latest", | ||
"lint-staged": "latest", | ||
"lodash.merge": "4.x", | ||
"lodash.set": "4.x", | ||
"npm-run-all": "latest", | ||
@@ -126,0 +122,0 @@ "prettier": "2.x", |
Sorry, the diff of this file is not supported yet
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
259793
38
113
4590
+ Addedlodash@4.x
- Removedlodash.memoize@4.x
- Removedlodash.memoize@4.1.2(transitive)