Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare const defaultOptions: Config.DefaultOptions;
export default defaultOptions;
//# sourceMappingURL=Defaults.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Defaults.d.ts","sourceRoot":"","sources":["../src/Defaults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAOnC,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,cAsE5B,CAAC;AAEF,eAAe,cAAc,CAAC"}

View File

@@ -5,10 +5,20 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _path() {
const data = require('path');
_path = function () {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function _jestRegexUtil() {
_jestRegexUtil = function () {
return data;
};
@@ -35,30 +45,23 @@ const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
const defaultOptions = {
automock: false,
bail: 0,
browser: false,
cache: true,
cacheDirectory: (0, _getCacheDirectory.default)(),
changedFilesWithAncestor: false,
clearMocks: false,
collectCoverage: false,
collectCoverageFrom: null,
coverageDirectory: null,
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageProvider: 'babel',
coverageReporters: ['json', 'text', 'lcov', 'clover'],
coverageThreshold: null,
dependencyExtractor: null,
errorOnDeprecated: false,
expand: false,
filter: null,
forceCoverageMatch: [],
globalSetup: null,
globalTeardown: null,
globals: {},
haste: {
computeSha1: false,
providesModuleNodeModules: [],
throwOnModuleCollision: false
},
injectGlobals: true,
maxConcurrency: 5,
maxWorkers: '50%',
moduleDirectories: ['node_modules'],
@@ -68,20 +71,17 @@ const defaultOptions = {
noStackTrace: false,
notify: false,
notifyMode: 'failure-change',
preset: null,
prettierPath: 'prettier',
projects: null,
resetMocks: false,
resetModules: false,
resolver: null,
restoreMocks: false,
rootDir: null,
roots: ['<rootDir>'],
runTestsByPath: false,
runner: 'jest-runner',
setupFiles: [],
setupFilesAfterEnv: [],
skipFilter: false,
slowTestThreshold: 5,
snapshotSerializers: [],
testEnvironment: 'jest-environment-jsdom',
testEnvironmentOptions: {},
@@ -90,15 +90,15 @@ const defaultOptions = {
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
testRegex: [],
testResultsProcessor: null,
testRunner: 'jasmine2',
testSequencer: '@jest/test-sequencer',
testURL: 'http://localhost',
timers: 'real',
transform: null,
transformIgnorePatterns: [NODE_MODULES_REGEXP],
transformIgnorePatterns: [
NODE_MODULES_REGEXP,
`\\.pnp\\.[^\\${_path().sep}]+$`
],
useStderr: false,
verbose: null,
watch: false,
watchPathIgnorePatterns: [],
watchman: true

View File

@@ -4,6 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare const _default: Record<string, Function>;
export default _default;
//# sourceMappingURL=Deprecated.d.ts.map
import type { DeprecatedOptions } from 'jest-validate';
declare const deprecatedOptions: DeprecatedOptions;
export default deprecatedOptions;

View File

@@ -1 +0,0 @@
{"version":3,"file":"Deprecated.d.ts","sourceRoot":"","sources":["../src/Deprecated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,wBAgE8B"}

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -18,7 +18,7 @@ function _chalk() {
function _prettyFormat() {
const data = _interopRequireDefault(require('pretty-format'));
_prettyFormat = function _prettyFormat() {
_prettyFormat = function () {
return data;
};
@@ -40,28 +40,26 @@ const format = value =>
min: true
});
var _default = {
const deprecatedOptions = {
browser: () => ` Option ${_chalk().default.bold(
'"browser"'
)} has been deprecated. Please install "browser-resolve" and use the "resolver" option in Jest configuration as follows:
{
${_chalk().default.bold('"resolver"')}: ${_chalk().default.bold(
'"browser-resolve"'
)}
}
`,
mapCoverage: () => ` Option ${_chalk().default.bold(
'"mapCoverage"'
)} has been removed, as it's no longer necessary.
Please update your configuration.`,
preprocessorIgnorePatterns: (function(_preprocessorIgnorePatterns) {
function preprocessorIgnorePatterns(_x) {
return _preprocessorIgnorePatterns.apply(this, arguments);
}
preprocessorIgnorePatterns.toString = function() {
return _preprocessorIgnorePatterns.toString();
};
return preprocessorIgnorePatterns;
})(
options => ` Option ${_chalk().default.bold(
'"preprocessorIgnorePatterns"'
)} was replaced by ${_chalk().default.bold(
'"transformIgnorePatterns"'
)}, which support multiple preprocessors.
preprocessorIgnorePatterns: options => ` Option ${_chalk().default.bold(
'"preprocessorIgnorePatterns"'
)} was replaced by ${_chalk().default.bold(
'"transformIgnorePatterns"'
)}, which support multiple preprocessors.
Jest now treats your current configuration as:
{
@@ -70,77 +68,41 @@ var _default = {
)}: ${_chalk().default.bold(format(options.preprocessorIgnorePatterns))}
}
Please update your configuration.`
),
scriptPreprocessor: (function(_scriptPreprocessor) {
function scriptPreprocessor(_x2) {
return _scriptPreprocessor.apply(this, arguments);
}
scriptPreprocessor.toString = function() {
return _scriptPreprocessor.toString();
};
return scriptPreprocessor;
})(
options => ` Option ${_chalk().default.bold(
'"scriptPreprocessor"'
)} was replaced by ${_chalk().default.bold(
'"transform"'
)}, which support multiple preprocessors.
Please update your configuration.`,
scriptPreprocessor: options => ` Option ${_chalk().default.bold(
'"scriptPreprocessor"'
)} was replaced by ${_chalk().default.bold(
'"transform"'
)}, which support multiple preprocessors.
Jest now treats your current configuration as:
{
${_chalk().default.bold('"transform"')}: ${_chalk().default.bold(
`{".*": ${format(options.scriptPreprocessor)}}`
)}
`{".*": ${format(options.scriptPreprocessor)}}`
)}
}
Please update your configuration.`
),
setupTestFrameworkScriptFile: (function(_setupTestFrameworkScriptFile) {
function setupTestFrameworkScriptFile(_x3) {
return _setupTestFrameworkScriptFile.apply(this, arguments);
}
Please update your configuration.`,
setupTestFrameworkScriptFile: _options => ` Option ${_chalk().default.bold(
'"setupTestFrameworkScriptFile"'
)} was replaced by configuration ${_chalk().default.bold(
'"setupFilesAfterEnv"'
)}, which supports multiple paths.
setupTestFrameworkScriptFile.toString = function() {
return _setupTestFrameworkScriptFile.toString();
};
return setupTestFrameworkScriptFile;
})(
_options => ` Option ${_chalk().default.bold(
'"setupTestFrameworkScriptFile"'
)} was replaced by configuration ${_chalk().default.bold(
'"setupFilesAfterEnv"'
)}, which supports multiple paths.
Please update your configuration.`
),
testPathDirs: (function(_testPathDirs) {
function testPathDirs(_x4) {
return _testPathDirs.apply(this, arguments);
}
testPathDirs.toString = function() {
return _testPathDirs.toString();
};
return testPathDirs;
})(
options => ` Option ${_chalk().default.bold(
'"testPathDirs"'
)} was replaced by ${_chalk().default.bold('"roots"')}.
Please update your configuration.`,
testPathDirs: options => ` Option ${_chalk().default.bold(
'"testPathDirs"'
)} was replaced by ${_chalk().default.bold('"roots"')}.
Jest now treats your current configuration as:
{
${_chalk().default.bold('"roots"')}: ${_chalk().default.bold(
format(options.testPathDirs)
)}
format(options.testPathDirs)
)}
}
Please update your configuration.
`
)
};
var _default = deprecatedOptions;
exports.default = _default;

View File

@@ -4,9 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare const descriptions: {
[key in keyof Config.InitialOptions]: string;
};
export default descriptions;
//# sourceMappingURL=Descriptions.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Descriptions.d.ts","sourceRoot":"","sources":["../src/Descriptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,QAAA,MAAM,YAAY,EAAE;KAAE,GAAG,IAAI,MAAM,MAAM,CAAC,cAAc,GAAG,MAAM;CAsFhE,CAAC;AAEF,eAAe,YAAY,CAAC"}

View File

@@ -14,7 +14,6 @@ exports.default = void 0;
const descriptions = {
automock: 'All imported modules in your tests should be mocked automatically',
bail: 'Stop running tests after `n` failures',
browser: 'Respect "browser" field in package.json when resolving modules',
cacheDirectory:
'The directory where Jest should store its cached dependency information',
clearMocks: 'Automatically clear mock calls and instances between every test',
@@ -26,6 +25,8 @@ const descriptions = {
'The directory where Jest should output its coverage files',
coveragePathIgnorePatterns:
'An array of regexp pattern strings used to skip coverage collection',
coverageProvider:
'Indicates which provider should be used to instrument code for coverage',
coverageReporters:
'A list of reporter names that Jest uses when writing coverage reports',
coverageThreshold:
@@ -47,7 +48,7 @@ const descriptions = {
"An array of directory names to be searched recursively up from the requiring module's location",
moduleFileExtensions: 'An array of file extensions your modules use',
moduleNameMapper:
'A map from regular expressions to module names that allow to stub out resources with a single module',
'A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module',
modulePathIgnorePatterns:
"An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader",
notify: 'Activates notifications for test results',
@@ -70,6 +71,8 @@ const descriptions = {
'The paths to modules that run some code to configure or set up the testing environment before each test',
setupFilesAfterEnv:
'A list of paths to modules that run some code to configure or set up the testing framework before each test',
slowTestThreshold:
'The number of seconds after which a test is considered as slow and reported as such in the results.',
snapshotSerializers:
'A list of paths to snapshot serializer modules Jest should use for snapshot testing',
testEnvironment: 'The test environment that will be used for testing',

View File

@@ -4,7 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
import { ValidationError } from 'jest-validate';
/**
* Reporter Validation Error is thrown if the given arguments
* within the reporter are not valid.
@@ -13,7 +14,6 @@ import { Config } from '@jest/types';
* merged with jest-validate. Till then, we can make use of it. It works
* and that's what counts most at this time.
*/
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): import("jest-validate/build/utils").ValidationError;
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, any>, expectedType: string, valueName: string): import("jest-validate/build/utils").ValidationError;
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): ValidationError;
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, unknown>, expectedType: string, valueName: string): ValidationError;
export declare function validateReporters(reporterConfig: Array<Config.ReporterConfig | string>): boolean;
//# sourceMappingURL=ReporterValidationErrors.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ReporterValidationErrors.d.ts","sourceRoot":"","sources":["../src/ReporterValidationErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AASnC;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,uDASrD;AAED,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,CAAC,cAAc,EACpC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,uDAiBlB;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,GACpD,OAAO,CAUT"}

View File

@@ -7,20 +7,10 @@ exports.createReporterError = createReporterError;
exports.createArrayReporterError = createArrayReporterError;
exports.validateReporters = validateReporters;
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function _jestValidate() {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -30,7 +20,17 @@ function _chalk() {
function _jestGetType() {
const data = _interopRequireDefault(require('jest-get-type'));
_jestGetType = function _jestGetType() {
_jestGetType = function () {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function () {
return data;
};
@@ -43,47 +43,12 @@ function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _slicedToArray(arr, i) {
return (
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
);
}
function _nonIterableRest() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (
var _i = arr[Symbol.iterator](), _s;
!(_n = (_s = _i.next()).done);
_n = true
) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i['return'] != null) _i['return']();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
/**
* 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.
*/
const validReporterTypes = ['array', 'string'];
const ERROR = `${_utils.BULLET}Reporter Validation Error`;
/**
@@ -103,7 +68,7 @@ function createReporterError(reporterIndex, reporterValue) {
` ${_chalk().default.bold.red(
(0, _jestGetType().default)(reporterValue)
)}`;
return new (_jestValidate()).ValidationError(
return new (_jestValidate().ValidationError)(
ERROR,
errorMessage,
_utils.DOCUMENTATION_NOTE
@@ -127,11 +92,9 @@ function createArrayReporterError(
` ${_chalk().default.bold.green((0, _jestGetType().default)(value))}\n` +
` Reporter configuration:\n` +
` ${_chalk().default.bold.green(
JSON.stringify(arrayReporter, null, 2)
.split('\n')
.join('\n ')
JSON.stringify(arrayReporter, null, 2).split('\n').join('\n ')
)}`;
return new (_jestValidate()).ValidationError(
return new (_jestValidate().ValidationError)(
ERROR,
errorMessage,
_utils.DOCUMENTATION_NOTE
@@ -151,9 +114,7 @@ function validateReporters(reporterConfig) {
}
function validateArrayReporter(arrayReporter, reporterIndex) {
const _arrayReporter = _slicedToArray(arrayReporter, 2),
path = _arrayReporter[0],
options = _arrayReporter[1];
const [path, options] = arrayReporter;
if (typeof path !== 'string') {
throw createArrayReporterError(

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare const initialOptions: Config.InitialOptions;
export default initialOptions;
//# sourceMappingURL=ValidConfig.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ValidConfig.d.ts","sourceRoot":"","sources":["../src/ValidConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAOnC,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,cA8H5B,CAAC;AAEF,eAAe,cAAc,CAAC"}

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function _jestRegexUtil() {
_jestRegexUtil = function () {
return data;
};
@@ -18,7 +18,7 @@ function _jestRegexUtil() {
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function _jestValidate() {
_jestValidate = function () {
return data;
};
@@ -39,7 +39,6 @@ const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
const initialOptions = {
automock: false,
bail: (0, _jestValidate().multipleValidOptions)(false, 0),
browser: false,
cache: true,
cacheDirectory: '/tmp/user/jest',
changedFilesWithAncestor: false,
@@ -52,6 +51,7 @@ const initialOptions = {
},
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageProvider: 'v8',
coverageReporters: ['json', 'text', 'lcov', 'clover'],
coverageThreshold: {
global: {
@@ -82,9 +82,9 @@ const initialOptions = {
defaultPlatform: 'ios',
hasteImplModulePath: '<rootDir>/haste_impl.js',
platforms: ['ios', 'android'],
providesModuleNodeModules: ['react', 'react-native'],
throwOnModuleCollision: false
},
injectGlobals: true,
json: false,
lastCommit: false,
logHeapUsage: true,
@@ -103,6 +103,7 @@ const initialOptions = {
notify: false,
notifyMode: 'failure-change',
onlyChanged: false,
onlyFailures: false,
preset: 'react-native',
prettierPath: '<rootDir>/node_modules/prettier',
projects: ['project-a', 'project-b/'],
@@ -129,6 +130,7 @@ const initialOptions = {
silent: true,
skipFilter: false,
skipNodeResolution: false,
slowTestThreshold: 5,
snapshotResolver: '<rootDir>/snapshotResolver.js',
snapshotSerializers: ['my-serializer-module'],
testEnvironment: 'jest-environment-jsdom',
@@ -140,10 +142,12 @@ const initialOptions = {
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
testNamePattern: 'test signature',
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
testRegex: (0, _jestValidate().multipleValidOptions)(
'(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$']
),
testRegex: (0,
_jestValidate()
.multipleValidOptions)('(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', [
'/__tests__/\\.test\\.[jt]sx?$',
'/__tests__/\\.spec\\.[jt]sx?$'
]),
testResultsProcessor: 'processor-node-module',
testRunner: 'jasmine2',
testSequencer: '@jest/test-sequencer',
@@ -151,7 +155,7 @@ const initialOptions = {
testURL: 'http://localhost',
timers: 'real',
transform: {
'^.+\\.js$': '<rootDir>/preprocessor.js'
'\\.js$': '<rootDir>/preprocessor.js'
},
transformIgnorePatterns: [NODE_MODULES_REGEXP],
unmockedModulePathPatterns: ['mock'],

10
node_modules/jest-config/build/color.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* 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.
*/
import type { ForegroundColor } from 'chalk';
declare type Color = typeof ForegroundColor;
export declare const getDisplayNameColor: (seed?: string | undefined) => Color;
export {};

37
node_modules/jest-config/build/color.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.getDisplayNameColor = void 0;
function _crypto() {
const data = require('crypto');
_crypto = function () {
return data;
};
return data;
}
/**
* 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.
*/
const colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
const getDisplayNameColor = seed => {
if (seed === undefined) {
return 'white';
}
const hash = (0, _crypto().createHash)('sha256');
hash.update(seed);
const num = hash.digest().readUInt32LE(0);
return colors[num % colors.length];
};
exports.getDisplayNameColor = getDisplayNameColor;

View File

@@ -5,8 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/
export declare const NODE_MODULES: string;
export declare const DEFAULT_JS_PATTERN = "^.+\\.[jt]sx?$";
export declare const DEFAULT_JS_PATTERN = "\\.[jt]sx?$";
export declare const DEFAULT_REPORTER_LABEL = "default";
export declare const PACKAGE_JSON = "package.json";
export declare const JEST_CONFIG = "jest.config.js";
//# sourceMappingURL=constants.d.ts.map
export declare const JEST_CONFIG_BASE_NAME = "jest.config";
export declare const JEST_CONFIG_EXT_CJS = ".cjs";
export declare const JEST_CONFIG_EXT_MJS = ".mjs";
export declare const JEST_CONFIG_EXT_JS = ".js";
export declare const JEST_CONFIG_EXT_TS = ".ts";
export declare const JEST_CONFIG_EXT_JSON = ".json";
export declare const JEST_CONFIG_EXT_ORDER: readonly string[];

View File

@@ -1 +0,0 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,YAAY,QAAuC,CAAC;AACjE,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAChD,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,mBAAmB,CAAC"}

View File

@@ -3,20 +3,58 @@
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.JEST_CONFIG = exports.PACKAGE_JSON = exports.DEFAULT_REPORTER_LABEL = exports.DEFAULT_JS_PATTERN = exports.NODE_MODULES = void 0;
exports.JEST_CONFIG_EXT_ORDER = exports.JEST_CONFIG_EXT_JSON = exports.JEST_CONFIG_EXT_TS = exports.JEST_CONFIG_EXT_JS = exports.JEST_CONFIG_EXT_MJS = exports.JEST_CONFIG_EXT_CJS = exports.JEST_CONFIG_BASE_NAME = exports.PACKAGE_JSON = exports.DEFAULT_REPORTER_LABEL = exports.DEFAULT_JS_PATTERN = exports.NODE_MODULES = void 0;
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
path = function () {
return data;
};
return data;
}
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;
}
/**
@@ -25,14 +63,31 @@ function _interopRequireDefault(obj) {
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const NODE_MODULES = _path().default.sep + 'node_modules' + _path().default.sep;
const NODE_MODULES = path().sep + 'node_modules' + path().sep;
exports.NODE_MODULES = NODE_MODULES;
const DEFAULT_JS_PATTERN = '^.+\\.[jt]sx?$';
const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
exports.DEFAULT_JS_PATTERN = DEFAULT_JS_PATTERN;
const DEFAULT_REPORTER_LABEL = 'default';
exports.DEFAULT_REPORTER_LABEL = DEFAULT_REPORTER_LABEL;
const PACKAGE_JSON = 'package.json';
exports.PACKAGE_JSON = PACKAGE_JSON;
const JEST_CONFIG = 'jest.config.js';
exports.JEST_CONFIG = JEST_CONFIG;
const JEST_CONFIG_BASE_NAME = 'jest.config';
exports.JEST_CONFIG_BASE_NAME = JEST_CONFIG_BASE_NAME;
const JEST_CONFIG_EXT_CJS = '.cjs';
exports.JEST_CONFIG_EXT_CJS = JEST_CONFIG_EXT_CJS;
const JEST_CONFIG_EXT_MJS = '.mjs';
exports.JEST_CONFIG_EXT_MJS = JEST_CONFIG_EXT_MJS;
const JEST_CONFIG_EXT_JS = '.js';
exports.JEST_CONFIG_EXT_JS = JEST_CONFIG_EXT_JS;
const JEST_CONFIG_EXT_TS = '.ts';
exports.JEST_CONFIG_EXT_TS = JEST_CONFIG_EXT_TS;
const JEST_CONFIG_EXT_JSON = '.json';
exports.JEST_CONFIG_EXT_JSON = JEST_CONFIG_EXT_JSON;
const JEST_CONFIG_EXT_ORDER = Object.freeze([
JEST_CONFIG_EXT_JS,
JEST_CONFIG_EXT_TS,
JEST_CONFIG_EXT_MJS,
JEST_CONFIG_EXT_CJS,
JEST_CONFIG_EXT_JSON
]);
exports.JEST_CONFIG_EXT_ORDER = JEST_CONFIG_EXT_ORDER;

View File

@@ -4,6 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare const getCacheDirectory: () => string;
import type { Config } from '@jest/types';
declare const getCacheDirectory: () => Config.Path;
export default getCacheDirectory;
//# sourceMappingURL=getCacheDirectory.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getCacheDirectory.d.ts","sourceRoot":"","sources":["../src/getCacheDirectory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,iBAAiB,cAWtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}

View File

@@ -5,38 +5,76 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _os() {
const data = _interopRequireDefault(require('os'));
const data = require('os');
_os = function _os() {
_os = function () {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
function path() {
const data = _interopRequireWildcard(require('path'));
_realpathNative = function _realpathNative() {
path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
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;
}
/**
@@ -46,21 +84,19 @@ function _interopRequireDefault(obj) {
* LICENSE file in the root directory of this source tree.
*/
const getCacheDirectory = () => {
const _process = process,
getuid = _process.getuid;
const tmpdir = _path().default.join(
(0, _realpathNative().sync)(_os().default.tmpdir()),
const {getuid} = process;
const tmpdirPath = path().join(
(0, _jestUtil().tryRealpath)((0, _os().tmpdir)()),
'jest'
);
if (getuid == null) {
return tmpdir;
return tmpdirPath;
} else {
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
// users and permission issues. Adding an additional subdivision by UID can
// help.
return `${tmpdir}_${getuid.call(process).toString(36)}`;
return `${tmpdirPath}_${getuid.call(process).toString(36)}`;
}
};

View File

@@ -4,6 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
export default function getMaxWorkers(argv: Partial<Pick<Config.Argv, 'maxWorkers' | 'runInBand' | 'watch'>>, defaultOptions?: Partial<Pick<Config.Argv, 'maxWorkers'>>): number;
//# sourceMappingURL=getMaxWorkers.d.ts.map
import type { Config } from '@jest/types';
export default function getMaxWorkers(argv: Partial<Pick<Config.Argv, 'maxWorkers' | 'runInBand' | 'watch' | 'watchAll'>>, defaultOptions?: Partial<Pick<Config.Argv, 'maxWorkers'>>): number;

View File

@@ -1 +0,0 @@
{"version":3,"file":"getMaxWorkers.d.ts","sourceRoot":"","sources":["../src/getMaxWorkers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC,EACtE,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,GACxD,MAAM,CAYR"}

View File

@@ -6,19 +6,15 @@ Object.defineProperty(exports, '__esModule', {
exports.default = getMaxWorkers;
function _os() {
const data = _interopRequireDefault(require('os'));
const data = require('os');
_os = function _os() {
_os = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
@@ -34,8 +30,12 @@ function getMaxWorkers(argv, defaultOptions) {
return parseWorkers(defaultOptions.maxWorkers);
} else {
// In watch mode, Jest should be unobtrusive and not use all available CPUs.
const cpus = _os().default.cpus() ? _os().default.cpus().length : 1;
return Math.max(argv.watch ? Math.floor(cpus / 2) : cpus - 1, 1);
const numCpus = (0, _os().cpus)() ? (0, _os().cpus)().length : 1;
const isWatchModeEnabled = argv.watch || argv.watchAll;
return Math.max(
isWatchModeEnabled ? Math.floor(numCpus / 2) : numCpus - 1,
1
);
}
}
@@ -48,9 +48,8 @@ const parseWorkers = maxWorkers => {
parsed > 0 &&
parsed <= 100
) {
const cpus = _os().default.cpus().length;
const workers = Math.floor((parsed / 100) * cpus);
const numCpus = (0, _os().cpus)().length;
const workers = Math.floor((parsed / 100) * numCpus);
return workers >= 1 ? workers : 1;
}

View File

@@ -4,23 +4,24 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
import * as constants from './constants';
export { getTestEnvironment, isJSONString } from './utils';
export { default as normalize } from './normalize';
export { default as deprecationEntries } from './Deprecated';
export { replaceRootDirInPath } from './utils';
export { default as defaults } from './Defaults';
export { default as descriptions } from './Descriptions';
export { constants };
declare type ReadConfig = {
configPath: Config.Path | null | undefined;
globalConfig: Config.GlobalConfig;
hasDeprecationWarnings: boolean;
projectConfig: Config.ProjectConfig;
};
export declare function readConfig(argv: Config.Argv, packageRootOrConfig: Config.Path | Config.InitialOptions, skipArgvConfigOption?: boolean, parentConfigPath?: Config.Path | null, projectIndex?: number): ReadConfig;
export declare function readConfigs(argv: Config.Argv, projectPaths: Array<Config.Path>): {
export declare function readConfig(argv: Config.Argv, packageRootOrConfig: Config.Path | Config.InitialOptions, skipArgvConfigOption?: boolean, parentConfigPath?: Config.Path | null, projectIndex?: number): Promise<ReadConfig>;
export declare function readConfigs(argv: Config.Argv, projectPaths: Array<Config.Path>): Promise<{
globalConfig: Config.GlobalConfig;
configs: Array<Config.ProjectConfig>;
hasDeprecationWarnings: boolean;
};
//# sourceMappingURL=index.d.ts.map
}>;

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAMnC,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAEvD,aAAK,UAAU,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;IAClC,sBAAsB,EAAE,OAAO,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC;CACrC,CAAC;AAEF,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,mBAAmB,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,cAAc,EAKxD,oBAAoB,CAAC,EAAE,OAAO,EAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,EACrC,YAAY,GAAE,MAAiB,GAC9B,UAAU,CAwDZ;AAuKD,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAC/B;IACD,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;IAClC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAwEA"}

View File

@@ -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);

View File

@@ -4,11 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
export default function normalize(options: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, projectIndex?: number): {
export default function normalize(initialOptions: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, projectIndex?: number): {
hasDeprecationWarnings: boolean;
options: AllOptions;
};
export {};
//# sourceMappingURL=normalize.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAiCnC,aAAK,UAAU,GAAG,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AAiX7D,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,OAAO,EAAE,MAAM,CAAC,cAAc,EAC9B,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,UAAU,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,EAC/B,YAAY,GAAE,MAAiB,GAC9B;IACD,sBAAsB,EAAE,OAAO,CAAC;IAChC,OAAO,EAAE,UAAU,CAAC;CACrB,CAukBA"}

View File

@@ -6,49 +6,19 @@ Object.defineProperty(exports, '__esModule', {
exports.default = normalize;
function _crypto() {
const data = _interopRequireDefault(require('crypto'));
const data = require('crypto');
_crypto = function _crypto() {
_crypto = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _glob() {
const data = _interopRequireDefault(require('glob'));
_glob = function _glob() {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function _jestValidate() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
path = function () {
return data;
};
@@ -58,7 +28,37 @@ function _jestUtil() {
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
return data;
}
function _deepmerge() {
const data = _interopRequireDefault(require('deepmerge'));
_deepmerge = function () {
return data;
};
return data;
}
function _glob() {
const data = require('glob');
_glob = function () {
return data;
};
return data;
}
function _gracefulFs() {
const data = require('graceful-fs');
_gracefulFs = function () {
return data;
};
@@ -68,27 +68,7 @@ function _chalk() {
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function _micromatch() {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
_realpathNative = function _realpathNative() {
return data;
};
return data;
}
function _jestResolve() {
const data = _interopRequireDefault(require('jest-resolve'));
_jestResolve = function _jestResolve() {
_micromatch = function () {
return data;
};
@@ -98,106 +78,185 @@ function _jestResolve() {
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function _jestRegexUtil() {
_jestRegexUtil = function () {
return data;
};
return data;
}
function _jestGetType() {
const data = _interopRequireDefault(require('jest-get-type'));
function _jestResolve() {
const data = _interopRequireDefault(require('jest-resolve'));
_jestGetType = function _jestGetType() {
_jestResolve = function () {
return data;
};
return data;
}
var _validatePattern = _interopRequireDefault(require('./validatePattern'));
function _jestUtil() {
const data = require('jest-util');
var _getMaxWorkers = _interopRequireDefault(require('./getMaxWorkers'));
_jestUtil = function () {
return data;
};
var _utils = require('./utils');
return data;
}
var _constants = require('./constants');
function _jestValidate() {
const data = require('jest-validate');
var _ReporterValidationErrors = require('./ReporterValidationErrors');
_jestValidate = function () {
return data;
};
return data;
}
var _Defaults = _interopRequireDefault(require('./Defaults'));
var _Deprecated = _interopRequireDefault(require('./Deprecated'));
var _setFromArgv = _interopRequireDefault(require('./setFromArgv'));
var _ReporterValidationErrors = require('./ReporterValidationErrors');
var _ValidConfig = _interopRequireDefault(require('./ValidConfig'));
var _color = require('./color');
var _constants = require('./constants');
var _getMaxWorkers = _interopRequireDefault(require('./getMaxWorkers'));
var _setFromArgv = _interopRequireDefault(require('./setFromArgv'));
var _utils = require('./utils');
var _validatePattern = _interopRequireDefault(require('./validatePattern'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
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];
}
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
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.
*/
const ERROR = `${_utils.BULLET}Validation Error`;
const PRESET_EXTENSIONS = ['.json', '.js'];
const PRESET_NAME = 'jest-preset';
const createConfigError = message =>
new (_jestValidate()).ValidationError(
new (_jestValidate().ValidationError)(
ERROR,
message,
_utils.DOCUMENTATION_NOTE
); // TS 3.5 forces us to split these into 2
);
function verifyDirectoryExists(path, key) {
try {
const rootStat = (0, _gracefulFs().statSync)(path);
if (!rootStat.isDirectory()) {
throw createConfigError(
` ${_chalk().default.bold(path)} in the ${_chalk().default.bold(
key
)} option is not a directory.`
);
}
} catch (err) {
if (err instanceof _jestValidate().ValidationError) {
throw err;
}
if (err.code === 'ENOENT') {
throw createConfigError(
` Directory ${_chalk().default.bold(
path
)} in the ${_chalk().default.bold(key)} option was not found.`
);
} // Not sure in which cases `statSync` can throw, so let's just show the underlying error to the user
throw createConfigError(
` Got an error trying to find ${_chalk().default.bold(
path
)} in the ${_chalk().default.bold(key)} option.\n\n Error was: ${
err.message
}`
);
}
} // TS 3.5 forces us to split these into 2
const mergeModuleNameMapperWithPreset = (options, preset) => {
if (options['moduleNameMapper'] && preset['moduleNameMapper']) {
options['moduleNameMapper'] = _objectSpread(
{},
options['moduleNameMapper'],
preset['moduleNameMapper'],
options['moduleNameMapper']
);
options['moduleNameMapper'] = {
...options['moduleNameMapper'],
...preset['moduleNameMapper'],
...options['moduleNameMapper']
};
}
};
const mergeTransformWithPreset = (options, preset) => {
if (options['transform'] && preset['transform']) {
options['transform'] = _objectSpread(
{},
options['transform'],
preset['transform'],
options['transform']
options['transform'] = {
...options['transform'],
...preset['transform'],
...options['transform']
};
}
};
const mergeGlobalsWithPreset = (options, preset) => {
if (options['globals'] && preset['globals']) {
options['globals'] = (0, _deepmerge().default)(
preset['globals'],
options['globals']
);
}
};
@@ -212,7 +271,7 @@ const setupPreset = (options, optionsPreset) => {
const presetModule = _jestResolve().default.findNodeModule(
presetPath.startsWith('.')
? presetPath
: _path().default.join(presetPath, PRESET_NAME),
: path().join(presetPath, PRESET_NAME),
{
basedir: options.rootDir,
extensions: PRESET_EXTENSIONS
@@ -220,12 +279,13 @@ const setupPreset = (options, optionsPreset) => {
);
try {
// Force re-evaluation to support multiple projects
if (!presetModule) {
throw new Error(`Cannot find module '${presetPath}'`);
} // Force re-evaluation to support multiple projects
try {
if (presetModule) {
delete require.cache[require.resolve(presetModule)];
}
} catch (e) {} // @ts-ignore: `presetModule` can be null?
delete require.cache[require.resolve(presetModule)];
} catch {}
preset = require(presetModule);
} catch (error) {
@@ -237,20 +297,36 @@ const setupPreset = (options, optionsPreset) => {
);
}
const preset = _jestResolve().default.findNodeModule(presetPath, {
basedir: options.rootDir
});
if (error.message.includes('Cannot find module')) {
if (error.message.includes(presetPath)) {
const preset = _jestResolve().default.findNodeModule(presetPath, {
basedir: options.rootDir
});
if (preset) {
throw createConfigError(
` Module ${_chalk().default.bold(
presetPath
)} should have "jest-preset.js" or "jest-preset.json" file at the root.`
);
}
throw createConfigError(
` Preset ${_chalk().default.bold(presetPath)} not found.`
);
}
if (preset) {
throw createConfigError(
` Module ${_chalk().default.bold(
presetPath
)} should have "jest-preset.js" or "jest-preset.json" file at the root.`
` Missing dependency in ${_chalk().default.bold(presetPath)}:\n\n ${
error.message
}\n ${error.stack}`
);
}
throw createConfigError(
` Preset ${_chalk().default.bold(presetPath)} not found.`
` An unknown error occurred in ${_chalk().default.bold(
presetPath
)}:\n\n ${error.message}\n ${error.stack}`
);
}
@@ -258,6 +334,12 @@ const setupPreset = (options, optionsPreset) => {
options.setupFiles = (preset.setupFiles || []).concat(options.setupFiles);
}
if (options.setupFilesAfterEnv) {
options.setupFilesAfterEnv = (preset.setupFilesAfterEnv || []).concat(
options.setupFilesAfterEnv
);
}
if (options.modulePathIgnorePatterns && preset.modulePathIgnorePatterns) {
options.modulePathIgnorePatterns = preset.modulePathIgnorePatterns.concat(
options.modulePathIgnorePatterns
@@ -266,7 +348,8 @@ const setupPreset = (options, optionsPreset) => {
mergeModuleNameMapperWithPreset(options, preset);
mergeTransformWithPreset(options, preset);
return _objectSpread({}, preset, options);
mergeGlobalsWithPreset(options, preset);
return {...preset, ...options};
};
const setupBabelJest = options => {
@@ -318,7 +401,7 @@ const normalizeCollectCoverageOnlyFrom = (options, key) => {
: Object.keys(initialCollectCoverageFrom); // passed from options
return collectCoverageOnlyFrom.reduce((map, filePath) => {
filePath = _path().default.resolve(
filePath = path().resolve(
options.rootDir,
(0, _utils.replaceRootDirInPath)(options.rootDir, filePath)
);
@@ -338,7 +421,7 @@ const normalizeCollectCoverageFrom = (options, key) => {
if (!Array.isArray(initialCollectCoverageFrom)) {
try {
value = JSON.parse(initialCollectCoverageFrom);
} catch (e) {}
} catch {}
if (options[key] && !Array.isArray(value)) {
value = [initialCollectCoverageFrom];
@@ -359,12 +442,12 @@ const normalizeCollectCoverageFrom = (options, key) => {
const normalizeUnmockedModulePathPatterns = (
options,
key // _replaceRootDirTags is specifically well-suited for substituting
) =>
// <rootDir> in paths (it deals with properly interpreting relative path
// separators, etc).
//
// For patterns, direct global substitution is far more ideal, so we
// special case substitutions for patterns here.
) =>
options[key].map(pattern =>
(0, _jestRegexUtil().replacePathSepForRegex)(
pattern.replace(/<rootDir>/g, options.rootDir)
@@ -409,8 +492,7 @@ const normalizePreprocessor = options => {
const normalizeMissingOptions = (options, configPath, projectIndex) => {
if (!options.name) {
options.name = _crypto()
.default.createHash('md5')
options.name = (0, _crypto().createHash)('md5')
.update(options.rootDir) // In case we load config from some path that has the same root dir
.update(configPath || '')
.update(String(projectIndex))
@@ -426,7 +508,7 @@ const normalizeMissingOptions = (options, configPath, projectIndex) => {
const normalizeRootDir = options => {
// Assert that there *is* a rootDir
if (!options.hasOwnProperty('rootDir')) {
if (!options.rootDir) {
throw createConfigError(
` Configuration option ${_chalk().default.bold(
'rootDir'
@@ -434,16 +516,17 @@ const normalizeRootDir = options => {
);
}
options.rootDir = _path().default.normalize(options.rootDir);
options.rootDir = path().normalize(options.rootDir);
try {
// try to resolve windows short paths, ignoring errors (permission errors, mostly)
options.rootDir = (0, _realpathNative().sync)(options.rootDir);
} catch (e) {
options.rootDir = (0, _jestUtil().tryRealpath)(options.rootDir);
} catch {
// ignored
}
return options;
verifyDirectoryExists(options.rootDir, 'rootDir');
return {...options, rootDir: options.rootDir};
};
const normalizeReporters = options => {
@@ -458,6 +541,7 @@ const normalizeReporters = options => {
const normalizedReporterConfig =
typeof reporterConfig === 'string' // if reporter config is a string, we wrap it in an array
? // and pass an empty object for options argument, to normalize
// the shape.
[reporterConfig, {}]
: reporterConfig;
const reporterPath = (0, _utils.replaceRootDirInPath)(
@@ -471,7 +555,7 @@ const normalizeReporters = options => {
});
if (!reporter) {
throw new Error(
throw new (_jestResolve().default.ModuleNotFoundError)(
`Could not resolve a module for a custom reporter.\n` +
` Module name: ${reporterPath}`
);
@@ -497,11 +581,14 @@ const buildTestPathPattern = argv => {
}
const replacePosixSep = pattern => {
if (_path().default.sep === '/') {
return pattern;
// yargs coerces positional args into numbers
const patternAsString = pattern.toString();
if (path().sep === '/') {
return patternAsString;
}
return pattern.replace(/\//g, '\\\\');
return patternAsString.replace(/\//g, '\\\\');
};
const testPathPattern = patterns.map(replacePosixSep).join('|');
@@ -524,26 +611,28 @@ const showTestPathPatternError = testPathPattern => {
);
};
function normalize(options, argv, configPath, projectIndex = Infinity) {
const _validate = (0, _jestValidate().validate)(options, {
function normalize(initialOptions, argv, configPath, projectIndex = Infinity) {
const {hasDeprecationWarnings} = (0, _jestValidate().validate)(
initialOptions,
{
comment: _utils.DOCUMENTATION_NOTE,
deprecatedConfig: _Deprecated.default,
exampleConfig: _ValidConfig.default,
recursiveBlacklist: [
'collectCoverageOnlyFrom', // 'coverageThreshold' allows to use 'global' and glob strings on the same
// level, there's currently no way we can deal with such config
'coverageThreshold',
'globals',
'moduleNameMapper',
'testEnvironmentOptions',
'transform'
]
}),
hasDeprecationWarnings = _validate.hasDeprecationWarnings;
options = normalizePreprocessor(
}
);
let options = normalizePreprocessor(
normalizeReporters(
normalizeMissingOptions(
normalizeRootDir((0, _setFromArgv.default)(options, argv)),
normalizeRootDir((0, _setFromArgv.default)(initialOptions, argv)),
configPath,
projectIndex
)
@@ -596,15 +685,12 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
}
if (!options.coverageDirectory) {
options.coverageDirectory = _path().default.resolve(
options.rootDir,
'coverage'
);
options.coverageDirectory = path().resolve(options.rootDir, 'coverage');
}
setupBabelJest(options); // TODO: Type this properly
const newOptions = _objectSpread({}, _Defaults.default);
const newOptions = {..._Defaults.default};
if (options.resolver) {
newOptions.resolver = (0, _utils.resolve)(null, {
@@ -655,7 +741,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
value =
option &&
option.map(filePath =>
_path().default.resolve(
path().resolve(
options.rootDir,
(0, _utils.replaceRootDirInPath)(options.rootDir, filePath)
)
@@ -673,7 +759,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
const option = oldOptions[key];
value =
option &&
_path().default.resolve(
path().resolve(
options.rootDir,
(0, _utils.replaceRootDirInPath)(options.rootDir, option)
);
@@ -759,7 +845,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
key,
rootDir: options.rootDir
}),
...(Array.isArray(transformElement) ? [transformElement[1]] : [])
Array.isArray(transformElement) ? transformElement[1] : {}
];
});
break;
@@ -774,7 +860,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
break;
case 'haste':
value = _objectSpread({}, oldOptions[key]);
value = {...oldOptions[key]};
if (value.hasteImplModulePath != null) {
const resolvedHasteImpl = (0, _utils.resolve)(newOptions.resolver, {
@@ -802,7 +888,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
// We expand it to these paths. If not, we keep the original path
// for the future resolution.
const globMatches =
typeof project === 'string' ? _glob().default.sync(project) : [];
typeof project === 'string' ? (0, _glob().sync)(project) : [];
return projects.concat(globMatches.length ? globMatches : project);
}, []);
break;
@@ -886,41 +972,13 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
case 'displayName': {
const displayName = oldOptions[key];
if (typeof displayName === 'string') {
value = displayName;
break;
}
/**
* Ensuring that displayName shape is correct here so that the
* reporters can trust the shape of the data
* TODO: Normalize "displayName" such that given a config option
* {
* "displayName": "Test"
* }
* becomes
* {
* displayName: {
* name: "Test",
* color: "white"
* }
* }
*
* This can't be done now since this will be a breaking change
* for custom reporters
*/
if ((0, _jestGetType().default)(displayName) === 'object') {
const errorMessage =
` Option "${_chalk().default.bold(
'displayName'
)}" must be of type:\n\n` +
' {\n' +
' name: string;\n' +
' color: string;\n' +
' }\n';
const name = displayName.name,
color = displayName.color;
if (typeof displayName === 'object') {
const {name, color} = displayName;
if (
!name ||
@@ -928,11 +986,25 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
typeof name !== 'string' ||
typeof color !== 'string'
) {
const errorMessage =
` Option "${_chalk().default.bold(
'displayName'
)}" must be of type:\n\n` +
' {\n' +
' name: string;\n' +
' color: string;\n' +
' }\n';
throw createConfigError(errorMessage);
}
value = oldOptions[key];
} else {
value = {
color: (0, _color.getDisplayNameColor)(options.runner),
name: displayName
};
}
value = oldOptions[key];
break;
}
@@ -950,12 +1022,12 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
}
case 'automock':
case 'browser':
case 'cache':
case 'changedSince':
case 'changedFilesWithAncestor':
case 'clearMocks':
case 'collectCoverage':
case 'coverageProvider':
case 'coverageReporters':
case 'coverageThreshold':
case 'detectLeaks':
@@ -967,6 +1039,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
case 'findRelatedTests':
case 'forceCoverageMatch':
case 'forceExit':
case 'injectGlobals':
case 'lastCommit':
case 'listTests':
case 'logHeapUsage':
@@ -977,6 +1050,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
case 'notify':
case 'notifyMode':
case 'onlyChanged':
case 'onlyFailures':
case 'outputFile':
case 'passWithNoTests':
case 'replname':
@@ -989,6 +1063,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
case 'silent':
case 'skipFilter':
case 'skipNodeResolution':
case 'slowTestThreshold':
case 'testEnvironment':
case 'testEnvironmentOptions':
case 'testFailureExitCode':
@@ -1025,16 +1100,19 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
}
});
break;
} // @ts-ignore: automock is missing in GlobalConfig, so what
} // @ts-expect-error: automock is missing in GlobalConfig, so what
newOptions[key] = value;
return newOptions;
}, newOptions);
newOptions.roots.forEach((root, i) => {
verifyDirectoryExists(root, `roots[${i}]`);
});
try {
// try to resolve windows short paths, ignoring errors (permission errors, mostly)
newOptions.cwd = (0, _realpathNative().sync)(process.cwd());
} catch (e) {
newOptions.cwd = (0, _jestUtil().tryRealpath)(process.cwd());
} catch {
// ignored
}
@@ -1057,12 +1135,33 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
if (argv.all) {
newOptions.onlyChanged = false;
newOptions.onlyFailures = false;
} else if (newOptions.testPathPattern) {
// When passing a test path pattern we don't want to only monitor changed
// files unless `--watch` is also passed.
newOptions.onlyChanged = newOptions.watch;
}
if (!newOptions.onlyChanged) {
newOptions.onlyChanged = false;
}
if (!newOptions.lastCommit) {
newOptions.lastCommit = false;
}
if (!newOptions.onlyFailures) {
newOptions.onlyFailures = false;
}
if (!newOptions.watchAll) {
newOptions.watchAll = false;
} // as unknown since it can happen. We really need to fix the types here
if (newOptions.moduleNameMapper === _Defaults.default.moduleNameMapper) {
newOptions.moduleNameMapper = [];
}
newOptions.updateSnapshot =
argv.ci && !argv.updateSnapshot
? 'none'
@@ -1099,20 +1198,22 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
if (newOptions.collectCoverage && argv.findRelatedTests) {
let collectCoverageFrom = argv._.map(filename => {
filename = (0, _utils.replaceRootDirInPath)(options.rootDir, filename);
return _path().default.isAbsolute(filename)
? _path().default.relative(options.rootDir, filename)
return path().isAbsolute(filename)
? path().relative(options.rootDir, filename)
: filename;
}); // Don't override existing collectCoverageFrom options
if (newOptions.collectCoverageFrom) {
collectCoverageFrom = collectCoverageFrom.reduce((patterns, filename) => {
if (
!_micromatch().default.some(
(0, _jestUtil().replacePathSepForGlob)(
_path().default.relative(options.rootDir, filename)
),
(0, _micromatch().default)(
[
(0, _jestUtil().replacePathSepForGlob)(
path().relative(options.rootDir, filename)
)
],
newOptions.collectCoverageFrom
)
).length === 0
) {
return patterns;
}
@@ -1122,6 +1223,28 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
}
newOptions.collectCoverageFrom = collectCoverageFrom;
} else if (!newOptions.collectCoverageFrom) {
newOptions.collectCoverageFrom = [];
}
if (!newOptions.findRelatedTests) {
newOptions.findRelatedTests = false;
}
if (!newOptions.projects) {
newOptions.projects = [];
}
if (!newOptions.extraGlobals) {
newOptions.extraGlobals = [];
}
if (!newOptions.forceExit) {
newOptions.forceExit = false;
}
if (!newOptions.logHeapUsage) {
newOptions.logHeapUsage = false;
}
return {

View File

@@ -4,7 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
declare const _default: (configPath: string) => Config.InitialOptions;
export default _default;
//# sourceMappingURL=readConfigFileAndSetRootDir.d.ts.map
import type { Config } from '@jest/types';
export default function readConfigFileAndSetRootDir(configPath: Config.Path): Promise<Config.InitialOptions>;

View File

@@ -1 +0,0 @@
{"version":3,"file":"readConfigFileAndSetRootDir.d.ts","sourceRoot":"","sources":["../src/readConfigFileAndSetRootDir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;;AAQnC,wBAsCE"}

View File

@@ -3,59 +3,153 @@
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
exports.default = readConfigFileAndSetRootDir;
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require('fs'));
function _url() {
const data = require('url');
_fs = function _fs() {
_url = function () {
return data;
};
return data;
}
var _jsonlint = _interopRequireDefault(require('./vendor/jsonlint'));
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _constants = require('./constants');
var _jsonlint = _interopRequireDefault(require('./vendor/jsonlint'));
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.
*/
// @ts-ignore: vendored
// @ts-expect-error: vendored
// Read the configuration and set its `rootDir`
// 1. If it's a `package.json` file, we look into its "jest" property
// 2. For any other file, we just require it.
var _default = configPath => {
const isJSON = configPath.endsWith('.json');
// 2. If it's a `jest.config.ts` file, we use `ts-node` to transpile & require it
// 3. For any other file, we just require it. If we receive an 'ERR_REQUIRE_ESM'
// from node, perform a dynamic import instead.
async function readConfigFileAndSetRootDir(configPath) {
const isTS = configPath.endsWith(_constants.JEST_CONFIG_EXT_TS);
const isJSON = configPath.endsWith(_constants.JEST_CONFIG_EXT_JSON);
let configObject;
try {
configObject = require(configPath);
if (isTS) {
configObject = await loadTSConfigFile(configPath);
} else {
configObject = require(configPath);
}
} catch (error) {
if (isJSON) {
if (error.code === 'ERR_REQUIRE_ESM') {
try {
const configUrl = (0, _url().pathToFileURL)(configPath); // node `import()` supports URL, but TypeScript doesn't know that
const importedConfig = await import(configUrl.href);
if (!importedConfig.default) {
throw new Error(
`Jest: Failed to load mjs config file ${configPath} - did you use a default export?`
);
}
configObject = importedConfig.default;
} catch (innerError) {
if (innerError.message === 'Not supported') {
throw new Error(
`Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file ${configPath}`
);
}
throw innerError;
}
} else if (isJSON) {
throw new Error(
`Jest: Failed to parse config file ${configPath}\n` +
` ${_jsonlint.default.errors(
_fs().default.readFileSync(configPath, 'utf8')
)}`
` ${_jsonlint.default.errors(fs().readFileSync(configPath, 'utf8'))}`
);
} else if (isTS) {
throw new Error(
`Jest: Failed to parse the TypeScript config file ${configPath}\n` +
` ${error}`
);
} else {
throw error;
@@ -70,19 +164,48 @@ var _default = configPath => {
if (configObject.rootDir) {
// We don't touch it if it has an absolute path specified
if (!_path().default.isAbsolute(configObject.rootDir)) {
if (!path().isAbsolute(configObject.rootDir)) {
// otherwise, we'll resolve it relative to the file's __dirname
configObject.rootDir = _path().default.resolve(
_path().default.dirname(configPath),
configObject.rootDir = path().resolve(
path().dirname(configPath),
configObject.rootDir
);
}
} else {
// If rootDir is not there, we'll set it to this file's __dirname
configObject.rootDir = _path().default.dirname(configPath);
configObject.rootDir = path().dirname(configPath);
}
return configObject;
};
} // Load the TypeScript configuration
exports.default = _default;
const loadTSConfigFile = async configPath => {
let registerer; // Register TypeScript compiler instance
try {
registerer = require('ts-node').register({
compilerOptions: {
module: 'CommonJS'
}
});
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
throw new Error(
`Jest: 'ts-node' is required for the TypeScript configuration files. Make sure it is installed\nError: ${e.message}`
);
}
throw e;
}
registerer.enabled(true);
let configObject = (0, _jestUtil().interopRequireDefault)(require(configPath))
.default; // In case the config is a function which imports more Typescript code
if (typeof configObject === 'function') {
configObject = await configObject();
}
registerer.enabled(false);
return configObject;
};

View File

@@ -4,6 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare const _default: (pathToResolve: string, cwd: string) => string;
import type { Config } from '@jest/types';
declare const _default: (pathToResolve: Config.Path, cwd: Config.Path) => Config.Path;
export default _default;
//# sourceMappingURL=resolveConfigPath.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"resolveConfigPath.d.ts","sourceRoot":"","sources":["../src/resolveConfigPath.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH,wBA+BE"}

View File

@@ -5,20 +5,20 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require('fs'));
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
_fs = function _fs() {
fs = function () {
return data;
};
@@ -27,8 +27,46 @@ function _fs() {
var _constants = require('./constants');
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;
}
/**
@@ -38,19 +76,18 @@ function _interopRequireDefault(obj) {
* LICENSE file in the root directory of this source tree.
*/
const isFile = filePath =>
_fs().default.existsSync(filePath) &&
!_fs()
.default.lstatSync(filePath)
.isDirectory();
fs().existsSync(filePath) && !fs().lstatSync(filePath).isDirectory();
const getConfigFilename = ext => _constants.JEST_CONFIG_BASE_NAME + ext;
var _default = (pathToResolve, cwd) => {
if (!_path().default.isAbsolute(cwd)) {
if (!path().isAbsolute(cwd)) {
throw new Error(`"cwd" must be an absolute path. cwd: ${cwd}`);
}
const absolutePath = _path().default.isAbsolute(pathToResolve)
const absolutePath = path().isAbsolute(pathToResolve)
? pathToResolve
: _path().default.resolve(cwd, pathToResolve);
: path().resolve(cwd, pathToResolve);
if (isFile(absolutePath)) {
return absolutePath;
@@ -65,7 +102,7 @@ var _default = (pathToResolve, cwd) => {
// name will resolve into a (possibly empty) `my_project/package.json` and
// try to run all tests it finds under `my_project` directory.
if (!_fs().default.existsSync(absolutePath)) {
if (!fs().existsSync(absolutePath)) {
throw new Error(
`Can't find a root directory while resolving a config file path.\n` +
`Provided path to resolve: ${pathToResolve}\n` +
@@ -79,31 +116,27 @@ var _default = (pathToResolve, cwd) => {
exports.default = _default;
const resolveConfigPathByTraversing = (pathToResolve, initialPath, cwd) => {
const jestConfig = _path().default.resolve(
pathToResolve,
_constants.JEST_CONFIG
);
const jestConfig = _constants.JEST_CONFIG_EXT_ORDER.map(ext =>
path().resolve(pathToResolve, getConfigFilename(ext))
).find(isFile);
if (isFile(jestConfig)) {
if (jestConfig) {
return jestConfig;
}
const packageJson = _path().default.resolve(
pathToResolve,
_constants.PACKAGE_JSON
);
const packageJson = path().resolve(pathToResolve, _constants.PACKAGE_JSON);
if (isFile(packageJson)) {
return packageJson;
} // This is the system root.
// We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
if (pathToResolve === _path().default.dirname(pathToResolve)) {
if (pathToResolve === path().dirname(pathToResolve)) {
throw new Error(makeResolutionErrorMessage(initialPath, cwd));
} // go up a level and try it again
return resolveConfigPathByTraversing(
_path().default.dirname(pathToResolve),
path().dirname(pathToResolve),
initialPath,
cwd
);
@@ -115,5 +148,6 @@ const makeResolutionErrorMessage = (initialPath, cwd) =>
`cwd: "${cwd}"\n` +
'Config paths must be specified by either a direct path to a config\n' +
'file, or a path to a directory. If directory is given, Jest will try to\n' +
`traverse directory tree up, until it finds either "${_constants.JEST_CONFIG}" or\n` +
`"${_constants.PACKAGE_JSON}".`;
`traverse directory tree up, until it finds one of those files in exact order: ${_constants.JEST_CONFIG_EXT_ORDER.map(
ext => `"${getConfigFilename(ext)}"`
).join(' or ')}.`;

View File

@@ -4,6 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
export default function setFromArgv(options: Config.InitialOptions, argv: Config.Argv): Config.InitialOptions;
//# sourceMappingURL=setFromArgv.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"setFromArgv.d.ts","sourceRoot":"","sources":["../src/setFromArgv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAKnC,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,OAAO,EAAE,MAAM,CAAC,cAAc,EAC9B,IAAI,EAAE,MAAM,CAAC,IAAI,GAChB,MAAM,CAAC,cAAc,CAyCvB"}

View File

@@ -7,38 +7,6 @@ exports.default = setFromArgv;
var _utils = require('./utils');
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
@@ -91,10 +59,9 @@ function setFromArgv(options, argv) {
return options;
}, {});
return _objectSpread(
{},
options,
(0, _utils.isJSONString)(argv.config) ? JSON.parse(argv.config) : null,
argvToOptions
);
return {
...options,
...((0, _utils.isJSONString)(argv.config) ? JSON.parse(argv.config) : null),
...argvToOptions
};
}

View File

@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare type ResolveOptions = {
rootDir: Config.Path;
key: string;
@@ -14,18 +14,18 @@ declare type ResolveOptions = {
export declare const BULLET: string;
export declare const DOCUMENTATION_NOTE: string;
export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string;
export declare const escapeGlobCharacters: (path: string) => string;
export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string;
export declare const escapeGlobCharacters: (path: Config.Path) => Config.Glob;
export declare const replaceRootDirInPath: (rootDir: Config.Path, filePath: Config.Path) => string;
declare type OrArray<T> = T | Array<T>;
declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
declare type ReplaceRootDirConfigValues = OrArray<ReplaceRootDirConfigObj> | OrArray<RegExp> | OrArray<Config.Path>;
export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: string, config: T) => T;
export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: Config.Path, config: T) => T;
export declare const resolveWithPrefix: (resolver: string | undefined | null, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
filePath: string;
humanOptionName: string;
optionName: string;
prefix: string;
rootDir: string;
rootDir: Config.Path;
}) => string;
/**
* Finds the test environment to use:
@@ -36,7 +36,7 @@ export declare const resolveWithPrefix: (resolver: string | null | undefined, {
* 1. looks for <name> relative to Jest.
*/
export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath, }: {
rootDir: string;
rootDir: Config.Path;
testEnvironment: string;
}) => string;
/**
@@ -47,9 +47,9 @@ export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath,
* 1. looks for <name> relative to project.
* 1. looks for <name> relative to Jest.
*/
export declare const getWatchPlugin: (resolver: string | null | undefined, { filePath, rootDir }: {
export declare const getWatchPlugin: (resolver: string | undefined | null, { filePath, rootDir }: {
filePath: string;
rootDir: string;
rootDir: Config.Path;
}) => string;
/**
* Finds the runner to use:
@@ -59,17 +59,16 @@ export declare const getWatchPlugin: (resolver: string | null | undefined, { fil
* 1. looks for <name> relative to project.
* 1. looks for <name> relative to Jest.
*/
export declare const getRunner: (resolver: string | null | undefined, { filePath, rootDir }: {
export declare const getRunner: (resolver: string | undefined | null, { filePath, rootDir }: {
filePath: string;
rootDir: string;
rootDir: Config.Path;
}) => string;
declare type JSONString = string & {
readonly $$type: never;
};
export declare const isJSONString: (text?: string | JSONString | undefined) => text is JSONString;
export declare const getSequencer: (resolver: string | null | undefined, { filePath, rootDir }: {
export declare const getSequencer: (resolver: string | undefined | null, { filePath, rootDir }: {
filePath: string;
rootDir: string;
rootDir: Config.Path;
}) => string;
export {};
//# sourceMappingURL=utils.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAKnC,aAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAA8B,CAAC;AACpD,eAAO,MAAM,kBAAkB,QAI9B,CAAC;AAKF,eAAO,MAAM,OAAO,uGAsBnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,0BACW,CAAC;AAE7C,eAAO,MAAM,oBAAoB,+CAYhC,CAAC;AAgBF,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/B,aAAK,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAC3D,aAAK,0BAA0B,GAC3B,OAAO,CAAC,uBAAuB,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,GACf,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzB,eAAO,MAAM,mBAAmB,yEAyB/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;YAgD7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB;;;YAa3B,CAAC;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;YAUvB,CAAC;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;YAUlB,CAAC;AAEL,aAAK,UAAU,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAA;CAAC,CAAC;AACpD,eAAO,MAAM,YAAY,gEAIL,CAAC;AAErB,eAAO,MAAM,YAAY;;;YAUrB,CAAC"}

View File

@@ -5,30 +5,10 @@ Object.defineProperty(exports, '__esModule', {
});
exports.getSequencer = exports.isJSONString = exports.getRunner = exports.getWatchPlugin = exports.getTestEnvironment = exports.resolveWithPrefix = exports._replaceRootDirTags = exports.replaceRootDirInPath = exports.escapeGlobCharacters = exports.resolve = exports.DOCUMENTATION_NOTE = exports.BULLET = void 0;
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function _jestValidate() {
return data;
};
return data;
}
function _jestResolve() {
const data = _interopRequireDefault(require('jest-resolve'));
_jestResolve = function _jestResolve() {
path = function () {
return data;
};
@@ -38,7 +18,27 @@ function _jestResolve() {
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
return data;
}
function _jestResolve() {
const data = _interopRequireDefault(require('jest-resolve'));
_jestResolve = function () {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = 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.
*
@@ -66,7 +108,7 @@ const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE;
const createValidationError = message =>
new (_jestValidate()).ValidationError(
new (_jestValidate().ValidationError)(
`${BULLET}Validation Error`,
message,
DOCUMENTATION_NOTE
@@ -102,9 +144,9 @@ const replaceRootDirInPath = (rootDir, filePath) => {
return filePath;
}
return _path().default.resolve(
return path().resolve(
rootDir,
_path().default.normalize('./' + filePath.substr('<rootDir>'.length))
path().normalize('./' + filePath.substr('<rootDir>'.length))
);
};
@@ -167,7 +209,7 @@ const resolveWithPrefix = (
try {
return require.resolve(`${prefix}${fileName}`);
} catch (e) {}
} catch {}
module = _jestResolve().default.findNodeModule(fileName, {
basedir: rootDir,
@@ -180,7 +222,7 @@ const resolveWithPrefix = (
try {
return require.resolve(fileName);
} catch (e) {}
} catch {}
throw createValidationError(
` ${humanOptionName} ${_chalk().default.bold(

View File

@@ -5,4 +5,3 @@
* LICENSE file in the root directory of this source tree.
*/
export default function validatePattern(pattern?: string): boolean;
//# sourceMappingURL=validatePattern.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"validatePattern.d.ts","sourceRoot":"","sources":["../src/validatePattern.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,WAWvD"}

View File

@@ -16,7 +16,7 @@ function validatePattern(pattern) {
try {
// eslint-disable-next-line no-new
new RegExp(pattern, 'i');
} catch (e) {
} catch {
return false;
}
}

View File

@@ -4,7 +4,7 @@
// Vendored in Jest to avoid jsonlint's transitive dependencies.
/* eslint-disable */
var jsonlint = (function() {
var jsonlint = (function () {
var parser = {
trace: function trace() {},
yy: {},
@@ -615,7 +615,7 @@ var jsonlint = (function() {
};
/* Jison generated lexer */
var lexer = (function() {
var lexer = (function () {
var lexer = {
EOF: 1,
parseError: function parseError(str, hash) {
@@ -625,7 +625,7 @@ var jsonlint = (function() {
throw new Error(str);
}
},
setInput: function setInput(input) {
setInput: function (input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
@@ -639,7 +639,7 @@ var jsonlint = (function() {
};
return this;
},
input: function input() {
input: function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
@@ -650,18 +650,18 @@ var jsonlint = (function() {
this._input = this._input.slice(1);
return ch;
},
unput: function unput(ch) {
unput: function (ch) {
this._input = ch + this._input;
return this;
},
more: function more() {
more: function () {
this._more = true;
return this;
},
less: function less(n) {
less: function (n) {
this._input = this.match.slice(n) + this._input;
},
pastInput: function pastInput() {
pastInput: function () {
var past = this.matched.substr(
0,
this.matched.length - this.match.length
@@ -670,7 +670,7 @@ var jsonlint = (function() {
(past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '')
);
},
upcomingInput: function upcomingInput() {
upcomingInput: function () {
var next = this.match;
if (next.length < 20) {
@@ -682,12 +682,12 @@ var jsonlint = (function() {
''
);
},
showPosition: function showPosition() {
showPosition: function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join('-');
return pre + this.upcomingInput() + '\n' + c + '^';
},
next: function next() {
next: function () {
if (this.done) {
return this.EOF;
}
@@ -777,7 +777,7 @@ var jsonlint = (function() {
this.conditionStack[this.conditionStack.length - 1]
].rules;
},
topState: function topState() {
topState: function () {
return this.conditionStack[this.conditionStack.length - 2];
},
pushState: function begin(condition) {
@@ -885,7 +885,7 @@ var jsonlint = (function() {
exports.parser = jsonlint;
exports.errors = function(input) {
exports.errors = function (input) {
try {
this.parse(input);
} catch (e) {
@@ -893,7 +893,7 @@ exports.errors = function(input) {
}
};
exports.parse = function() {
exports.parse = function () {
return jsonlint.parse.apply(jsonlint, arguments);
};