Updating NPM dependencies
This commit is contained in:
273
node_modules/jest-config/build/index.js
generated
vendored
273
node_modules/jest-config/build/index.js
generated
vendored
@@ -5,63 +5,54 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.readConfig = readConfig;
|
||||
exports.readConfigs = readConfigs;
|
||||
Object.defineProperty(exports, 'normalize', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _normalize.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'getTestEnvironment', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _utils.getTestEnvironment;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isJSONString', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _utils.isJSONString;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'replaceRootDirInPath', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _utils.replaceRootDirInPath;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'normalize', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _normalize2.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'deprecationEntries', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _Deprecated.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'defaults', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _Defaults.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'descriptions', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
get: function () {
|
||||
return _Descriptions.default;
|
||||
}
|
||||
});
|
||||
exports.constants = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require('fs'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -71,23 +62,47 @@ function _path() {
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require('./utils');
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
var _normalize2 = _interopRequireDefault(require('./normalize'));
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
var _resolveConfigPath = _interopRequireDefault(require('./resolveConfigPath'));
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var constants = _interopRequireWildcard(require('./constants'));
|
||||
|
||||
exports.constants = constants;
|
||||
|
||||
var _normalize = _interopRequireDefault(require('./normalize'));
|
||||
|
||||
var _readConfigFileAndSetRootDir = _interopRequireDefault(
|
||||
require('./readConfigFileAndSetRootDir')
|
||||
);
|
||||
|
||||
var _resolveConfigPath = _interopRequireDefault(require('./resolveConfigPath'));
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _Deprecated = _interopRequireDefault(require('./Deprecated'));
|
||||
|
||||
var _Defaults = _interopRequireDefault(require('./Defaults'));
|
||||
@@ -98,17 +113,60 @@ 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.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
function readConfig(
|
||||
async function readConfig(
|
||||
argv,
|
||||
packageRootOrConfig, // Whether it needs to look into `--config` arg passed to CLI.
|
||||
// It only used to read initial config. If the initial config contains
|
||||
// `project` property, we don't want to read `--config` value and rather
|
||||
// read individual configs for every project.
|
||||
skipArgvConfigOption,
|
||||
parentConfigPath,
|
||||
projectIndex = Infinity
|
||||
@@ -118,8 +176,7 @@ function readConfig(
|
||||
|
||||
if (typeof packageRootOrConfig !== 'string') {
|
||||
if (parentConfigPath) {
|
||||
const parentConfigDirname = _path().default.dirname(parentConfigPath);
|
||||
|
||||
const parentConfigDirname = path().dirname(parentConfigPath);
|
||||
rawOptions = packageRootOrConfig;
|
||||
rawOptions.rootDir = rawOptions.rootDir
|
||||
? (0, _utils.replaceRootDirInPath)(
|
||||
@@ -139,7 +196,7 @@ function readConfig(
|
||||
|
||||
try {
|
||||
config = JSON.parse(argv.config);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
throw new Error(
|
||||
'There was an error while parsing the `--config` argument as a JSON string.'
|
||||
);
|
||||
@@ -147,32 +204,30 @@ function readConfig(
|
||||
|
||||
config.rootDir = config.rootDir || packageRootOrConfig;
|
||||
rawOptions = config; // A string passed to `--config`, which is either a direct path to the config
|
||||
// or a path to directory containing `package.json` or `jest.config.js`
|
||||
// or a path to directory containing `package.json`, `jest.config.js` or `jest.config.ts`
|
||||
} else if (!skipArgvConfigOption && typeof argv.config == 'string') {
|
||||
configPath = (0, _resolveConfigPath.default)(argv.config, process.cwd());
|
||||
rawOptions = (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
} else {
|
||||
// Otherwise just try to find config in the current rootDir.
|
||||
configPath = (0, _resolveConfigPath.default)(
|
||||
packageRootOrConfig,
|
||||
process.cwd()
|
||||
);
|
||||
rawOptions = (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
}
|
||||
|
||||
const _normalize = (0, _normalize2.default)(
|
||||
rawOptions,
|
||||
argv,
|
||||
configPath,
|
||||
projectIndex
|
||||
),
|
||||
options = _normalize.options,
|
||||
hasDeprecationWarnings = _normalize.hasDeprecationWarnings;
|
||||
|
||||
const _groupOptions = groupOptions(options),
|
||||
globalConfig = _groupOptions.globalConfig,
|
||||
projectConfig = _groupOptions.projectConfig;
|
||||
if (typeof rawOptions === 'function') {
|
||||
rawOptions = await rawOptions();
|
||||
}
|
||||
|
||||
const {options, hasDeprecationWarnings} = (0, _normalize.default)(
|
||||
rawOptions,
|
||||
argv,
|
||||
configPath,
|
||||
projectIndex
|
||||
);
|
||||
const {globalConfig, projectConfig} = groupOptions(options);
|
||||
return {
|
||||
configPath,
|
||||
globalConfig,
|
||||
@@ -190,6 +245,7 @@ const groupOptions = options => ({
|
||||
collectCoverageFrom: options.collectCoverageFrom,
|
||||
collectCoverageOnlyFrom: options.collectCoverageOnlyFrom,
|
||||
coverageDirectory: options.coverageDirectory,
|
||||
coverageProvider: options.coverageProvider,
|
||||
coverageReporters: options.coverageReporters,
|
||||
coverageThreshold: options.coverageThreshold,
|
||||
detectLeaks: options.detectLeaks,
|
||||
@@ -197,7 +253,6 @@ const groupOptions = options => ({
|
||||
enabledTestsMap: options.enabledTestsMap,
|
||||
errorOnDeprecated: options.errorOnDeprecated,
|
||||
expand: options.expand,
|
||||
extraGlobals: options.extraGlobals,
|
||||
filter: options.filter,
|
||||
findRelatedTests: options.findRelatedTests,
|
||||
forceExit: options.forceExit,
|
||||
@@ -241,7 +296,6 @@ const groupOptions = options => ({
|
||||
}),
|
||||
projectConfig: Object.freeze({
|
||||
automock: options.automock,
|
||||
browser: options.browser,
|
||||
cache: options.cache,
|
||||
cacheDirectory: options.cacheDirectory,
|
||||
clearMocks: options.clearMocks,
|
||||
@@ -259,6 +313,7 @@ const groupOptions = options => ({
|
||||
globalTeardown: options.globalTeardown,
|
||||
globals: options.globals,
|
||||
haste: options.haste,
|
||||
injectGlobals: options.injectGlobals,
|
||||
moduleDirectories: options.moduleDirectories,
|
||||
moduleFileExtensions: options.moduleFileExtensions,
|
||||
moduleLoader: options.moduleLoader,
|
||||
@@ -278,6 +333,7 @@ const groupOptions = options => ({
|
||||
setupFilesAfterEnv: options.setupFilesAfterEnv,
|
||||
skipFilter: options.skipFilter,
|
||||
skipNodeResolution: options.skipNodeResolution,
|
||||
slowTestThreshold: options.slowTestThreshold,
|
||||
snapshotResolver: options.snapshotResolver,
|
||||
snapshotSerializers: options.snapshotSerializers,
|
||||
testEnvironment: options.testEnvironment,
|
||||
@@ -302,23 +358,14 @@ const ensureNoDuplicateConfigs = (parsedConfigs, projects) => {
|
||||
}
|
||||
|
||||
const configPathMap = new Map();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = parsedConfigs[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const config = _step.value;
|
||||
const configPath = config.configPath;
|
||||
for (const config of parsedConfigs) {
|
||||
const {configPath} = config;
|
||||
|
||||
if (configPathMap.has(configPath)) {
|
||||
const message = `Whoops! Two projects resolved to the same config path: ${_chalk().default.bold(
|
||||
String(configPath)
|
||||
)}:
|
||||
if (configPathMap.has(configPath)) {
|
||||
const message = `Whoops! Two projects resolved to the same config path: ${_chalk().default.bold(
|
||||
String(configPath)
|
||||
)}:
|
||||
|
||||
Project 1: ${_chalk().default.bold(
|
||||
projects[parsedConfigs.findIndex(x => x === config)]
|
||||
@@ -328,28 +375,14 @@ const ensureNoDuplicateConfigs = (parsedConfigs, projects) => {
|
||||
)}
|
||||
|
||||
This usually means that your ${_chalk().default.bold(
|
||||
'"projects"'
|
||||
)} config includes a directory that doesn't have any configuration recognizable by Jest. Please fix it.
|
||||
'"projects"'
|
||||
)} config includes a directory that doesn't have any configuration recognizable by Jest. Please fix it.
|
||||
`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
if (configPath !== null) {
|
||||
configPathMap.set(configPath, config);
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
|
||||
if (configPath !== null) {
|
||||
configPathMap.set(configPath, config);
|
||||
}
|
||||
}
|
||||
}; // Possible scenarios:
|
||||
@@ -362,7 +395,7 @@ This usually means that your ${_chalk().default.bold(
|
||||
// If no projects are specified, process.cwd() will be used as the default
|
||||
// (and only) project.
|
||||
|
||||
function readConfigs(argv, projectPaths) {
|
||||
async function readConfigs(argv, projectPaths) {
|
||||
let globalConfig;
|
||||
let hasDeprecationWarnings;
|
||||
let configs = [];
|
||||
@@ -370,15 +403,8 @@ function readConfigs(argv, projectPaths) {
|
||||
let configPath;
|
||||
|
||||
if (projectPaths.length === 1) {
|
||||
const parsedConfig = readConfig(argv, projects[0]);
|
||||
const parsedConfig = await readConfig(argv, projects[0]);
|
||||
configPath = parsedConfig.configPath;
|
||||
|
||||
if (parsedConfig.globalConfig.projects) {
|
||||
// If this was a single project, and its config has `projects`
|
||||
// settings, use that value instead.
|
||||
projects = parsedConfig.globalConfig.projects;
|
||||
}
|
||||
|
||||
hasDeprecationWarnings = parsedConfig.hasDeprecationWarnings;
|
||||
globalConfig = parsedConfig.globalConfig;
|
||||
configs = [parsedConfig.projectConfig];
|
||||
@@ -386,34 +412,47 @@ function readConfigs(argv, projectPaths) {
|
||||
if (globalConfig.projects && globalConfig.projects.length) {
|
||||
// Even though we had one project in CLI args, there might be more
|
||||
// projects defined in the config.
|
||||
// In other words, if this was a single project,
|
||||
// and its config has `projects` settings, use that value instead.
|
||||
projects = globalConfig.projects;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
projects.length > 1 ||
|
||||
(projects.length && typeof projects[0] === 'object')
|
||||
) {
|
||||
const parsedConfigs = projects
|
||||
.filter(root => {
|
||||
// Ignore globbed files that cannot be `require`d.
|
||||
if (
|
||||
typeof root === 'string' &&
|
||||
_fs().default.existsSync(root) &&
|
||||
!_fs()
|
||||
.default.lstatSync(root)
|
||||
.isDirectory() &&
|
||||
!root.endsWith('.js') &&
|
||||
!root.endsWith('.json')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (projects.length > 0) {
|
||||
const projectIsCwd =
|
||||
process.platform === 'win32'
|
||||
? projects[0] === (0, _jestUtil().tryRealpath)(process.cwd())
|
||||
: projects[0] === process.cwd();
|
||||
const parsedConfigs = await Promise.all(
|
||||
projects
|
||||
.filter(root => {
|
||||
// Ignore globbed files that cannot be `require`d.
|
||||
if (
|
||||
typeof root === 'string' &&
|
||||
fs().existsSync(root) &&
|
||||
!fs().lstatSync(root).isDirectory() &&
|
||||
!constants.JEST_CONFIG_EXT_ORDER.some(ext => root.endsWith(ext))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.map((root, projectIndex) =>
|
||||
readConfig(argv, root, true, configPath, projectIndex)
|
||||
);
|
||||
return true;
|
||||
})
|
||||
.map((root, projectIndex) => {
|
||||
const projectIsTheOnlyProject =
|
||||
projectIndex === 0 && projects.length === 1;
|
||||
const skipArgvConfigOption = !(
|
||||
projectIsTheOnlyProject && projectIsCwd
|
||||
);
|
||||
return readConfig(
|
||||
argv,
|
||||
root,
|
||||
skipArgvConfigOption,
|
||||
configPath,
|
||||
projectIndex
|
||||
);
|
||||
})
|
||||
);
|
||||
ensureNoDuplicateConfigs(parsedConfigs, projects);
|
||||
configs = parsedConfigs.map(({projectConfig}) => projectConfig);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user