Updating NPM dependencies
This commit is contained in:
130
node_modules/@jest/transform/build/shouldInstrument.js
generated
vendored
130
node_modules/@jest/transform/build/shouldInstrument.js
generated
vendored
@@ -5,30 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = shouldInstrument;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
|
||||
_jestRegexUtil = function _jestRegexUtil() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function _jestUtil() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -38,7 +18,27 @@ function _jestUtil() {
|
||||
function _micromatch() {
|
||||
const data = _interopRequireDefault(require('micromatch'));
|
||||
|
||||
_micromatch = function _micromatch() {
|
||||
_micromatch = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -49,6 +49,48 @@ function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
@@ -57,9 +99,21 @@ function _interopRequireDefault(obj) {
|
||||
*/
|
||||
const MOCKS_PATTERN = new RegExp(
|
||||
(0, _jestRegexUtil().escapePathForRegex)(
|
||||
_path().default.sep + '__mocks__' + _path().default.sep
|
||||
path().sep + '__mocks__' + path().sep
|
||||
)
|
||||
);
|
||||
const cachedRegexes = new Map();
|
||||
|
||||
const getRegex = regexStr => {
|
||||
if (!cachedRegexes.has(regexStr)) {
|
||||
cachedRegexes.set(regexStr, new RegExp(regexStr));
|
||||
}
|
||||
|
||||
const regex = cachedRegexes.get(regexStr); // prevent stateful regexes from breaking, just in case
|
||||
|
||||
regex.lastIndex = 0;
|
||||
return regex;
|
||||
};
|
||||
|
||||
function shouldInstrument(filename, options, config) {
|
||||
if (!options.collectCoverage) {
|
||||
@@ -74,16 +128,17 @@ function shouldInstrument(filename, options, config) {
|
||||
}
|
||||
|
||||
if (
|
||||
!config.testPathIgnorePatterns.some(pattern => !!filename.match(pattern))
|
||||
!config.testPathIgnorePatterns.some(pattern =>
|
||||
getRegex(pattern).test(filename)
|
||||
)
|
||||
) {
|
||||
if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
_micromatch().default.some(
|
||||
(0, _jestUtil().replacePathSepForGlob)(filename),
|
||||
config.testMatch
|
||||
(0, _jestUtil().globsToMatcher)(config.testMatch)(
|
||||
(0, _jestUtil().replacePathSepForGlob)(filename)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
@@ -102,12 +157,11 @@ function shouldInstrument(filename, options, config) {
|
||||
if (
|
||||
// still cover if `only` is specified
|
||||
!options.collectCoverageOnlyFrom &&
|
||||
options.collectCoverageFrom &&
|
||||
!_micromatch().default.some(
|
||||
options.collectCoverageFrom.length &&
|
||||
!(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)(
|
||||
(0, _jestUtil().replacePathSepForGlob)(
|
||||
_path().default.relative(config.rootDir, filename)
|
||||
),
|
||||
options.collectCoverageFrom
|
||||
path().relative(config.rootDir, filename)
|
||||
)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
@@ -140,7 +194,13 @@ function shouldInstrument(filename, options, config) {
|
||||
}
|
||||
|
||||
if (options.changedFiles && !options.changedFiles.has(filename)) {
|
||||
return false;
|
||||
if (!options.sourcesRelatedToTestsInChangedFiles) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user