Initial commit
This commit is contained in:
21
node_modules/jest-config/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
129
node_modules/jest-config/build/Defaults.js
generated
vendored
Normal file
129
node_modules/jest-config/build/Defaults.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _path() {
|
||||
const data = require('path');
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _ciInfo() {
|
||||
const data = require('ci-info');
|
||||
_ciInfo = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _constants = require('./constants');
|
||||
var _getCacheDirectory = _interopRequireDefault(require('./getCacheDirectory'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
|
||||
_constants.NODE_MODULES
|
||||
);
|
||||
const defaultOptions = {
|
||||
automock: false,
|
||||
bail: 0,
|
||||
cache: true,
|
||||
cacheDirectory: (0, _getCacheDirectory.default)(),
|
||||
changedFilesWithAncestor: false,
|
||||
ci: _ciInfo().isCI,
|
||||
clearMocks: false,
|
||||
collectCoverage: false,
|
||||
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
coverageProvider: 'babel',
|
||||
coverageReporters: ['json', 'text', 'lcov', 'clover'],
|
||||
detectLeaks: false,
|
||||
detectOpenHandles: false,
|
||||
errorOnDeprecated: false,
|
||||
expand: false,
|
||||
extensionsToTreatAsEsm: [],
|
||||
fakeTimers: {
|
||||
enableGlobally: false
|
||||
},
|
||||
forceCoverageMatch: [],
|
||||
globals: {},
|
||||
haste: {
|
||||
computeSha1: false,
|
||||
enableSymlinks: false,
|
||||
forceNodeFilesystemAPI: true,
|
||||
throwOnModuleCollision: false
|
||||
},
|
||||
injectGlobals: true,
|
||||
listTests: false,
|
||||
maxConcurrency: 5,
|
||||
maxWorkers: '50%',
|
||||
moduleDirectories: ['node_modules'],
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'jsx',
|
||||
'ts',
|
||||
'tsx',
|
||||
'json',
|
||||
'node'
|
||||
],
|
||||
moduleNameMapper: {},
|
||||
modulePathIgnorePatterns: [],
|
||||
noStackTrace: false,
|
||||
notify: false,
|
||||
notifyMode: 'failure-change',
|
||||
openHandlesTimeout: 1000,
|
||||
passWithNoTests: false,
|
||||
prettierPath: 'prettier',
|
||||
resetMocks: false,
|
||||
resetModules: false,
|
||||
restoreMocks: false,
|
||||
roots: ['<rootDir>'],
|
||||
runTestsByPath: false,
|
||||
runner: 'jest-runner',
|
||||
setupFiles: [],
|
||||
setupFilesAfterEnv: [],
|
||||
skipFilter: false,
|
||||
slowTestThreshold: 5,
|
||||
snapshotFormat: {
|
||||
escapeString: false,
|
||||
printBasicPrototype: false
|
||||
},
|
||||
snapshotSerializers: [],
|
||||
testEnvironment: 'jest-environment-node',
|
||||
testEnvironmentOptions: {},
|
||||
testFailureExitCode: 1,
|
||||
testLocationInResults: false,
|
||||
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
|
||||
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
testRegex: [],
|
||||
testRunner: 'jest-circus/runner',
|
||||
testSequencer: '@jest/test-sequencer',
|
||||
transformIgnorePatterns: [
|
||||
NODE_MODULES_REGEXP,
|
||||
`\\.pnp\\.[^\\${_path().sep}]+$`
|
||||
],
|
||||
useStderr: false,
|
||||
watch: false,
|
||||
watchPathIgnorePatterns: [],
|
||||
watchman: true,
|
||||
workerThreads: false
|
||||
};
|
||||
var _default = defaultOptions;
|
||||
exports.default = _default;
|
||||
85
node_modules/jest-config/build/Deprecated.js
generated
vendored
Normal file
85
node_modules/jest-config/build/Deprecated.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const deprecatedOptions = {
|
||||
browser: () =>
|
||||
` Option ${_chalk().default.bold(
|
||||
'"browser"'
|
||||
)} has been deprecated. Please install "browser-resolve" and use the "resolver" option in Jest configuration as shown in the documentation: https://jestjs.io/docs/configuration#resolver-string`,
|
||||
collectCoverageOnlyFrom: _options => ` Option ${_chalk().default.bold(
|
||||
'"collectCoverageOnlyFrom"'
|
||||
)} was replaced by ${_chalk().default.bold('"collectCoverageFrom"')}.
|
||||
|
||||
Please update your configuration.`,
|
||||
extraGlobals: _options => ` Option ${_chalk().default.bold(
|
||||
'"extraGlobals"'
|
||||
)} was replaced by ${_chalk().default.bold('"sandboxInjectedGlobals"')}.
|
||||
|
||||
Please update your configuration.`,
|
||||
moduleLoader: _options => ` Option ${_chalk().default.bold(
|
||||
'"moduleLoader"'
|
||||
)} was replaced by ${_chalk().default.bold('"runtime"')}.
|
||||
|
||||
Please update your configuration.`,
|
||||
preprocessorIgnorePatterns: _options => ` Option ${_chalk().default.bold(
|
||||
'"preprocessorIgnorePatterns"'
|
||||
)} was replaced by ${_chalk().default.bold(
|
||||
'"transformIgnorePatterns"'
|
||||
)}, 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.
|
||||
|
||||
Please update your configuration.`,
|
||||
setupTestFrameworkScriptFile: _options => ` Option ${_chalk().default.bold(
|
||||
'"setupTestFrameworkScriptFile"'
|
||||
)} was replaced by configuration ${_chalk().default.bold(
|
||||
'"setupFilesAfterEnv"'
|
||||
)}, which supports multiple paths.
|
||||
|
||||
Please update your configuration.`,
|
||||
testPathDirs: _options => ` Option ${_chalk().default.bold(
|
||||
'"testPathDirs"'
|
||||
)} was replaced by ${_chalk().default.bold('"roots"')}.
|
||||
|
||||
Please update your configuration.
|
||||
`,
|
||||
testURL: _options => ` Option ${_chalk().default.bold(
|
||||
'"testURL"'
|
||||
)} was replaced by passing the URL via ${_chalk().default.bold(
|
||||
'"testEnvironmentOptions.url"'
|
||||
)}.
|
||||
|
||||
Please update your configuration.`,
|
||||
timers: _options => ` Option ${_chalk().default.bold(
|
||||
'"timers"'
|
||||
)} was replaced by ${_chalk().default.bold('"fakeTimers"')}.
|
||||
|
||||
Please update your configuration.`
|
||||
};
|
||||
var _default = deprecatedOptions;
|
||||
exports.default = _default;
|
||||
104
node_modules/jest-config/build/Descriptions.js
generated
vendored
Normal file
104
node_modules/jest-config/build/Descriptions.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const descriptions = {
|
||||
automock: 'All imported modules in your tests should be mocked automatically',
|
||||
bail: 'Stop running tests after `n` failures',
|
||||
cacheDirectory:
|
||||
'The directory where Jest should store its cached dependency information',
|
||||
clearMocks:
|
||||
'Automatically clear mock calls, instances, contexts and results before every test',
|
||||
collectCoverage:
|
||||
'Indicates whether the coverage information should be collected while executing the test',
|
||||
collectCoverageFrom:
|
||||
'An array of glob patterns indicating a set of files for which coverage information should be collected',
|
||||
coverageDirectory:
|
||||
'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:
|
||||
'An object that configures minimum threshold enforcement for coverage results',
|
||||
dependencyExtractor: 'A path to a custom dependency extractor',
|
||||
errorOnDeprecated:
|
||||
'Make calling deprecated APIs throw helpful error messages',
|
||||
fakeTimers: 'The default configuration for fake timers',
|
||||
forceCoverageMatch:
|
||||
'Force coverage collection from ignored files using an array of glob patterns',
|
||||
globalSetup:
|
||||
'A path to a module which exports an async function that is triggered once before all test suites',
|
||||
globalTeardown:
|
||||
'A path to a module which exports an async function that is triggered once after all test suites',
|
||||
globals:
|
||||
'A set of global variables that need to be available in all test environments',
|
||||
maxWorkers:
|
||||
'The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.',
|
||||
moduleDirectories:
|
||||
"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 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',
|
||||
notifyMode:
|
||||
'An enum that specifies notification mode. Requires { notify: true }',
|
||||
preset: "A preset that is used as a base for Jest's configuration",
|
||||
projects: 'Run tests from one or more projects',
|
||||
reporters: 'Use this configuration option to add custom reporters to Jest',
|
||||
resetMocks: 'Automatically reset mock state before every test',
|
||||
resetModules: 'Reset the module registry before running each individual test',
|
||||
resolver: 'A path to a custom resolver',
|
||||
restoreMocks:
|
||||
'Automatically restore mock state and implementation before every test',
|
||||
rootDir:
|
||||
'The root directory that Jest should scan for tests and modules within',
|
||||
roots:
|
||||
'A list of paths to directories that Jest should use to search for files in',
|
||||
runner:
|
||||
"Allows you to use a custom runner instead of Jest's default test runner",
|
||||
setupFiles:
|
||||
'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',
|
||||
testEnvironmentOptions: 'Options that will be passed to the testEnvironment',
|
||||
testLocationInResults: 'Adds a location field to test results',
|
||||
testMatch: 'The glob patterns Jest uses to detect test files',
|
||||
testPathIgnorePatterns:
|
||||
'An array of regexp pattern strings that are matched against all test paths, matched tests are skipped',
|
||||
testRegex:
|
||||
'The regexp pattern or array of patterns that Jest uses to detect test files',
|
||||
testResultsProcessor:
|
||||
'This option allows the use of a custom results processor',
|
||||
testRunner: 'This option allows use of a custom test runner',
|
||||
transform: 'A map from regular expressions to paths to transformers',
|
||||
transformIgnorePatterns:
|
||||
'An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation',
|
||||
unmockedModulePathPatterns:
|
||||
'An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them',
|
||||
verbose:
|
||||
'Indicates whether each individual test should be reported during the run',
|
||||
watchPathIgnorePatterns:
|
||||
'An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode',
|
||||
watchman: 'Whether to use watchman for file crawling'
|
||||
};
|
||||
var _default = descriptions;
|
||||
exports.default = _default;
|
||||
122
node_modules/jest-config/build/ReporterValidationErrors.js
generated
vendored
Normal file
122
node_modules/jest-config/build/ReporterValidationErrors.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.createArrayReporterError = createArrayReporterError;
|
||||
exports.createReporterError = createReporterError;
|
||||
exports.validateReporters = validateReporters;
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestGetType() {
|
||||
const data = require('jest-get-type');
|
||||
_jestGetType = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _utils = require('./utils');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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`;
|
||||
|
||||
/**
|
||||
* Reporter Validation Error is thrown if the given arguments
|
||||
* within the reporter are not valid.
|
||||
*
|
||||
* This is a highly specific reporter error and in the future will be
|
||||
* merged with jest-validate. Till then, we can make use of it. It works
|
||||
* and that's what counts most at this time.
|
||||
*/
|
||||
function createReporterError(reporterIndex, reporterValue) {
|
||||
const errorMessage =
|
||||
` Reporter at index ${reporterIndex} must be of type:\n` +
|
||||
` ${_chalk().default.bold.green(validReporterTypes.join(' or '))}\n` +
|
||||
' but instead received:\n' +
|
||||
` ${_chalk().default.bold.red(
|
||||
(0, _jestGetType().getType)(reporterValue)
|
||||
)}`;
|
||||
return new (_jestValidate().ValidationError)(
|
||||
ERROR,
|
||||
errorMessage,
|
||||
_utils.DOCUMENTATION_NOTE
|
||||
);
|
||||
}
|
||||
function createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
valueIndex,
|
||||
value,
|
||||
expectedType,
|
||||
valueName
|
||||
) {
|
||||
const errorMessage =
|
||||
` Unexpected value for ${valueName} ` +
|
||||
`at index ${valueIndex} of reporter at index ${reporterIndex}\n` +
|
||||
' Expected:\n' +
|
||||
` ${_chalk().default.bold.red(expectedType)}\n` +
|
||||
' Got:\n' +
|
||||
` ${_chalk().default.bold.green((0, _jestGetType().getType)(value))}\n` +
|
||||
' Reporter configuration:\n' +
|
||||
` ${_chalk().default.bold.green(
|
||||
JSON.stringify(arrayReporter, null, 2).split('\n').join('\n ')
|
||||
)}`;
|
||||
return new (_jestValidate().ValidationError)(
|
||||
ERROR,
|
||||
errorMessage,
|
||||
_utils.DOCUMENTATION_NOTE
|
||||
);
|
||||
}
|
||||
function validateReporters(reporterConfig) {
|
||||
return reporterConfig.every((reporter, index) => {
|
||||
if (Array.isArray(reporter)) {
|
||||
validateArrayReporter(reporter, index);
|
||||
} else if (typeof reporter !== 'string') {
|
||||
throw createReporterError(index, reporter);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
function validateArrayReporter(arrayReporter, reporterIndex) {
|
||||
const [path, options] = arrayReporter;
|
||||
if (typeof path !== 'string') {
|
||||
throw createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
0,
|
||||
path,
|
||||
'string',
|
||||
'Path'
|
||||
);
|
||||
} else if (typeof options !== 'object') {
|
||||
throw createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
1,
|
||||
options,
|
||||
'object',
|
||||
'Reporter Configuration'
|
||||
);
|
||||
}
|
||||
}
|
||||
342
node_modules/jest-config/build/ValidConfig.js
generated
vendored
Normal file
342
node_modules/jest-config/build/ValidConfig.js
generated
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.initialProjectOptions = exports.initialOptions = void 0;
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _prettyFormat() {
|
||||
const data = require('pretty-format');
|
||||
_prettyFormat = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _constants = require('./constants');
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
|
||||
_constants.NODE_MODULES
|
||||
);
|
||||
const initialOptions = {
|
||||
automock: false,
|
||||
bail: (0, _jestValidate().multipleValidOptions)(false, 0),
|
||||
cache: true,
|
||||
cacheDirectory: '/tmp/user/jest',
|
||||
changedFilesWithAncestor: false,
|
||||
changedSince: 'master',
|
||||
ci: false,
|
||||
clearMocks: false,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src', '!public'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
coverageProvider: 'v8',
|
||||
coverageReporters: ['json', 'text', 'lcov', 'clover'],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 50,
|
||||
functions: 100,
|
||||
lines: 100,
|
||||
statements: 100
|
||||
}
|
||||
},
|
||||
dependencyExtractor: '<rootDir>/dependencyExtractor.js',
|
||||
detectLeaks: false,
|
||||
detectOpenHandles: false,
|
||||
displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
|
||||
color: 'blue',
|
||||
name: 'test-config'
|
||||
}),
|
||||
errorOnDeprecated: false,
|
||||
expand: false,
|
||||
extensionsToTreatAsEsm: [],
|
||||
fakeTimers: {
|
||||
advanceTimers: (0, _jestValidate().multipleValidOptions)(40, true),
|
||||
doNotFake: [
|
||||
'Date',
|
||||
'hrtime',
|
||||
'nextTick',
|
||||
'performance',
|
||||
'queueMicrotask',
|
||||
'requestAnimationFrame',
|
||||
'cancelAnimationFrame',
|
||||
'requestIdleCallback',
|
||||
'cancelIdleCallback',
|
||||
'setImmediate',
|
||||
'clearImmediate',
|
||||
'setInterval',
|
||||
'clearInterval',
|
||||
'setTimeout',
|
||||
'clearTimeout'
|
||||
],
|
||||
enableGlobally: true,
|
||||
legacyFakeTimers: false,
|
||||
now: 1483228800000,
|
||||
timerLimit: 1000
|
||||
},
|
||||
filter: '<rootDir>/filter.js',
|
||||
forceCoverageMatch: ['**/*.t.js'],
|
||||
forceExit: false,
|
||||
globalSetup: 'setup.js',
|
||||
globalTeardown: 'teardown.js',
|
||||
globals: {
|
||||
__DEV__: true
|
||||
},
|
||||
haste: {
|
||||
computeSha1: true,
|
||||
defaultPlatform: 'ios',
|
||||
enableSymlinks: false,
|
||||
forceNodeFilesystemAPI: true,
|
||||
hasteImplModulePath: '<rootDir>/haste_impl.js',
|
||||
hasteMapModulePath: '',
|
||||
platforms: ['ios', 'android'],
|
||||
retainAllFiles: false,
|
||||
throwOnModuleCollision: false
|
||||
},
|
||||
id: 'string',
|
||||
injectGlobals: true,
|
||||
json: false,
|
||||
lastCommit: false,
|
||||
listTests: false,
|
||||
logHeapUsage: true,
|
||||
maxConcurrency: 5,
|
||||
maxWorkers: '50%',
|
||||
moduleDirectories: ['node_modules'],
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'json',
|
||||
'jsx',
|
||||
'ts',
|
||||
'tsx',
|
||||
'node'
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^React$': '<rootDir>/node_modules/react'
|
||||
},
|
||||
modulePathIgnorePatterns: ['<rootDir>/build/'],
|
||||
modulePaths: ['/shared/vendor/modules'],
|
||||
noStackTrace: false,
|
||||
notify: false,
|
||||
notifyMode: 'failure-change',
|
||||
onlyChanged: false,
|
||||
onlyFailures: false,
|
||||
openHandlesTimeout: 1000,
|
||||
passWithNoTests: false,
|
||||
preset: 'react-native',
|
||||
prettierPath: '<rootDir>/node_modules/prettier',
|
||||
projects: ['project-a', 'project-b/'],
|
||||
randomize: false,
|
||||
reporters: [
|
||||
'default',
|
||||
'custom-reporter-1',
|
||||
[
|
||||
'custom-reporter-2',
|
||||
{
|
||||
configValue: true
|
||||
}
|
||||
]
|
||||
],
|
||||
resetMocks: false,
|
||||
resetModules: false,
|
||||
resolver: '<rootDir>/resolver.js',
|
||||
restoreMocks: false,
|
||||
rootDir: '/',
|
||||
roots: ['<rootDir>'],
|
||||
runTestsByPath: false,
|
||||
runner: 'jest-runner',
|
||||
runtime: '<rootDir>',
|
||||
sandboxInjectedGlobals: [],
|
||||
setupFiles: ['<rootDir>/setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
|
||||
showSeed: false,
|
||||
silent: true,
|
||||
skipFilter: false,
|
||||
skipNodeResolution: false,
|
||||
slowTestThreshold: 5,
|
||||
snapshotFormat: _prettyFormat().DEFAULT_OPTIONS,
|
||||
snapshotResolver: '<rootDir>/snapshotResolver.js',
|
||||
snapshotSerializers: ['my-serializer-module'],
|
||||
testEnvironment: 'jest-environment-node',
|
||||
testEnvironmentOptions: {
|
||||
url: 'http://localhost',
|
||||
userAgent: 'Agent/007'
|
||||
},
|
||||
testFailureExitCode: 1,
|
||||
testLocationInResults: false,
|
||||
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?$']
|
||||
),
|
||||
testResultsProcessor: 'processor-node-module',
|
||||
testRunner: 'circus',
|
||||
testSequencer: '@jest/test-sequencer',
|
||||
testTimeout: 5000,
|
||||
transform: {
|
||||
'\\.js$': '<rootDir>/preprocessor.js'
|
||||
},
|
||||
transformIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
unmockedModulePathPatterns: ['mock'],
|
||||
updateSnapshot: true,
|
||||
useStderr: false,
|
||||
verbose: false,
|
||||
watch: false,
|
||||
watchAll: false,
|
||||
watchPathIgnorePatterns: ['<rootDir>/e2e/'],
|
||||
watchPlugins: [
|
||||
'path/to/yourWatchPlugin',
|
||||
[
|
||||
'jest-watch-typeahead/filename',
|
||||
{
|
||||
key: 'k',
|
||||
prompt: 'do something with my custom prompt'
|
||||
}
|
||||
]
|
||||
],
|
||||
watchman: true,
|
||||
workerIdleMemoryLimit: (0, _jestValidate().multipleValidOptions)(0.2, '50%'),
|
||||
workerThreads: true
|
||||
};
|
||||
exports.initialOptions = initialOptions;
|
||||
const initialProjectOptions = {
|
||||
automock: false,
|
||||
cache: true,
|
||||
cacheDirectory: '/tmp/user/jest',
|
||||
clearMocks: false,
|
||||
collectCoverageFrom: ['src', '!public'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
dependencyExtractor: '<rootDir>/dependencyExtractor.js',
|
||||
detectLeaks: false,
|
||||
detectOpenHandles: false,
|
||||
displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
|
||||
color: 'blue',
|
||||
name: 'test-config'
|
||||
}),
|
||||
errorOnDeprecated: false,
|
||||
extensionsToTreatAsEsm: [],
|
||||
fakeTimers: {
|
||||
advanceTimers: (0, _jestValidate().multipleValidOptions)(40, true),
|
||||
doNotFake: [
|
||||
'Date',
|
||||
'hrtime',
|
||||
'nextTick',
|
||||
'performance',
|
||||
'queueMicrotask',
|
||||
'requestAnimationFrame',
|
||||
'cancelAnimationFrame',
|
||||
'requestIdleCallback',
|
||||
'cancelIdleCallback',
|
||||
'setImmediate',
|
||||
'clearImmediate',
|
||||
'setInterval',
|
||||
'clearInterval',
|
||||
'setTimeout',
|
||||
'clearTimeout'
|
||||
],
|
||||
enableGlobally: true,
|
||||
legacyFakeTimers: false,
|
||||
now: 1483228800000,
|
||||
timerLimit: 1000
|
||||
},
|
||||
filter: '<rootDir>/filter.js',
|
||||
forceCoverageMatch: ['**/*.t.js'],
|
||||
globalSetup: 'setup.js',
|
||||
globalTeardown: 'teardown.js',
|
||||
globals: {
|
||||
__DEV__: true
|
||||
},
|
||||
haste: {
|
||||
computeSha1: true,
|
||||
defaultPlatform: 'ios',
|
||||
enableSymlinks: false,
|
||||
forceNodeFilesystemAPI: true,
|
||||
hasteImplModulePath: '<rootDir>/haste_impl.js',
|
||||
hasteMapModulePath: '',
|
||||
platforms: ['ios', 'android'],
|
||||
retainAllFiles: false,
|
||||
throwOnModuleCollision: false
|
||||
},
|
||||
id: 'string',
|
||||
injectGlobals: true,
|
||||
moduleDirectories: ['node_modules'],
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'json',
|
||||
'jsx',
|
||||
'ts',
|
||||
'tsx',
|
||||
'node'
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'^React$': '<rootDir>/node_modules/react'
|
||||
},
|
||||
modulePathIgnorePatterns: ['<rootDir>/build/'],
|
||||
modulePaths: ['/shared/vendor/modules'],
|
||||
openHandlesTimeout: 1000,
|
||||
preset: 'react-native',
|
||||
prettierPath: '<rootDir>/node_modules/prettier',
|
||||
resetMocks: false,
|
||||
resetModules: false,
|
||||
resolver: '<rootDir>/resolver.js',
|
||||
restoreMocks: false,
|
||||
rootDir: '/',
|
||||
roots: ['<rootDir>'],
|
||||
runner: 'jest-runner',
|
||||
runtime: '<rootDir>',
|
||||
sandboxInjectedGlobals: [],
|
||||
setupFiles: ['<rootDir>/setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
|
||||
skipFilter: false,
|
||||
skipNodeResolution: false,
|
||||
slowTestThreshold: 5,
|
||||
snapshotFormat: _prettyFormat().DEFAULT_OPTIONS,
|
||||
snapshotResolver: '<rootDir>/snapshotResolver.js',
|
||||
snapshotSerializers: ['my-serializer-module'],
|
||||
testEnvironment: 'jest-environment-node',
|
||||
testEnvironmentOptions: {
|
||||
url: 'http://localhost',
|
||||
userAgent: 'Agent/007'
|
||||
},
|
||||
testLocationInResults: false,
|
||||
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
testRegex: (0, _jestValidate().multipleValidOptions)(
|
||||
'(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
|
||||
['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$']
|
||||
),
|
||||
testRunner: 'circus',
|
||||
transform: {
|
||||
'\\.js$': '<rootDir>/preprocessor.js'
|
||||
},
|
||||
transformIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
unmockedModulePathPatterns: ['mock'],
|
||||
watchPathIgnorePatterns: ['<rootDir>/e2e/'],
|
||||
workerIdleMemoryLimit: (0, _jestValidate().multipleValidOptions)(0.2, '50%')
|
||||
};
|
||||
exports.initialProjectOptions = initialProjectOptions;
|
||||
31
node_modules/jest-config/build/color.js
generated
vendored
Normal file
31
node_modules/jest-config/build/color.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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;
|
||||
96
node_modules/jest-config/build/constants.js
generated
vendored
Normal file
96
node_modules/jest-config/build/constants.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.PACKAGE_JSON =
|
||||
exports.NODE_MODULES =
|
||||
exports.JEST_CONFIG_EXT_TS =
|
||||
exports.JEST_CONFIG_EXT_ORDER =
|
||||
exports.JEST_CONFIG_EXT_MJS =
|
||||
exports.JEST_CONFIG_EXT_JSON =
|
||||
exports.JEST_CONFIG_EXT_JS =
|
||||
exports.JEST_CONFIG_EXT_CJS =
|
||||
exports.JEST_CONFIG_BASE_NAME =
|
||||
exports.DEFAULT_JS_PATTERN =
|
||||
void 0;
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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().sep}node_modules${path().sep}`;
|
||||
exports.NODE_MODULES = NODE_MODULES;
|
||||
const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
|
||||
exports.DEFAULT_JS_PATTERN = DEFAULT_JS_PATTERN;
|
||||
const PACKAGE_JSON = 'package.json';
|
||||
exports.PACKAGE_JSON = PACKAGE_JSON;
|
||||
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;
|
||||
91
node_modules/jest-config/build/getCacheDirectory.js
generated
vendored
Normal file
91
node_modules/jest-config/build/getCacheDirectory.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _os() {
|
||||
const data = require('os');
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const getCacheDirectory = () => {
|
||||
const {getuid} = process;
|
||||
const tmpdirPath = path().join(
|
||||
(0, _jestUtil().tryRealpath)((0, _os().tmpdir)()),
|
||||
'jest'
|
||||
);
|
||||
if (getuid == null) {
|
||||
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 `${tmpdirPath}_${getuid.call(process).toString(36)}`;
|
||||
}
|
||||
};
|
||||
var _default = getCacheDirectory;
|
||||
exports.default = _default;
|
||||
56
node_modules/jest-config/build/getMaxWorkers.js
generated
vendored
Normal file
56
node_modules/jest-config/build/getMaxWorkers.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = getMaxWorkers;
|
||||
function _os() {
|
||||
const data = require('os');
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
function getNumCpus() {
|
||||
return typeof _os().availableParallelism === 'function'
|
||||
? (0, _os().availableParallelism)()
|
||||
: (0, _os().cpus)()?.length ?? 1;
|
||||
}
|
||||
function getMaxWorkers(argv, defaultOptions) {
|
||||
if (argv.runInBand) {
|
||||
return 1;
|
||||
} else if (argv.maxWorkers) {
|
||||
return parseWorkers(argv.maxWorkers);
|
||||
} else if (defaultOptions && defaultOptions.maxWorkers) {
|
||||
return parseWorkers(defaultOptions.maxWorkers);
|
||||
} else {
|
||||
// In watch mode, Jest should be unobtrusive and not use all available CPUs.
|
||||
const numCpus = getNumCpus();
|
||||
const isWatchModeEnabled = argv.watch || argv.watchAll;
|
||||
return Math.max(
|
||||
isWatchModeEnabled ? Math.floor(numCpus / 2) : numCpus - 1,
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
const parseWorkers = maxWorkers => {
|
||||
const parsed = parseInt(maxWorkers.toString(), 10);
|
||||
if (
|
||||
typeof maxWorkers === 'string' &&
|
||||
maxWorkers.trim().endsWith('%') &&
|
||||
parsed > 0 &&
|
||||
parsed <= 100
|
||||
) {
|
||||
const numCpus = getNumCpus();
|
||||
const workers = Math.floor((parsed / 100) * numCpus);
|
||||
return Math.max(workers, 1);
|
||||
}
|
||||
return parsed > 0 ? parsed : 1;
|
||||
};
|
||||
147
node_modules/jest-config/build/index.d.ts
generated
vendored
Normal file
147
node_modules/jest-config/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import type {Config} from '@jest/types';
|
||||
import type {DeprecatedOptions} from 'jest-validate';
|
||||
|
||||
declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
|
||||
|
||||
declare namespace constants {
|
||||
export {
|
||||
NODE_MODULES,
|
||||
DEFAULT_JS_PATTERN,
|
||||
PACKAGE_JSON,
|
||||
JEST_CONFIG_BASE_NAME,
|
||||
JEST_CONFIG_EXT_CJS,
|
||||
JEST_CONFIG_EXT_MJS,
|
||||
JEST_CONFIG_EXT_JS,
|
||||
JEST_CONFIG_EXT_TS,
|
||||
JEST_CONFIG_EXT_JSON,
|
||||
JEST_CONFIG_EXT_ORDER,
|
||||
};
|
||||
}
|
||||
export {constants};
|
||||
|
||||
declare const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
|
||||
|
||||
export declare const defaults: Config.DefaultOptions;
|
||||
|
||||
export declare const deprecationEntries: DeprecatedOptions;
|
||||
|
||||
export declare const descriptions: {
|
||||
[key in keyof Config.InitialOptions]: string;
|
||||
};
|
||||
|
||||
export declare const isJSONString: (
|
||||
text?: JSONString | string,
|
||||
) => text is JSONString;
|
||||
|
||||
declare const JEST_CONFIG_BASE_NAME = 'jest.config';
|
||||
|
||||
declare const JEST_CONFIG_EXT_CJS = '.cjs';
|
||||
|
||||
declare const JEST_CONFIG_EXT_JS = '.js';
|
||||
|
||||
declare const JEST_CONFIG_EXT_JSON = '.json';
|
||||
|
||||
declare const JEST_CONFIG_EXT_MJS = '.mjs';
|
||||
|
||||
declare const JEST_CONFIG_EXT_ORDER: readonly string[];
|
||||
|
||||
declare const JEST_CONFIG_EXT_TS = '.ts';
|
||||
|
||||
declare type JSONString = string & {
|
||||
readonly $$type: never;
|
||||
};
|
||||
|
||||
declare const NODE_MODULES: string;
|
||||
|
||||
export declare function normalize(
|
||||
initialOptions: Config.InitialOptions,
|
||||
argv: Config.Argv,
|
||||
configPath?: string | null,
|
||||
projectIndex?: number,
|
||||
isProjectOptions?: boolean,
|
||||
): Promise<{
|
||||
hasDeprecationWarnings: boolean;
|
||||
options: AllOptions;
|
||||
}>;
|
||||
|
||||
declare const PACKAGE_JSON = 'package.json';
|
||||
|
||||
declare type ReadConfig = {
|
||||
configPath: string | null | undefined;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
hasDeprecationWarnings: boolean;
|
||||
projectConfig: Config.ProjectConfig;
|
||||
};
|
||||
|
||||
export declare function readConfig(
|
||||
argv: Config.Argv,
|
||||
packageRootOrConfig: string | Config.InitialOptions,
|
||||
skipArgvConfigOption?: boolean,
|
||||
parentConfigDirname?: string | null,
|
||||
projectIndex?: number,
|
||||
skipMultipleConfigError?: boolean,
|
||||
): Promise<ReadConfig>;
|
||||
|
||||
export declare function readConfigs(
|
||||
argv: Config.Argv,
|
||||
projectPaths: Array<string>,
|
||||
): Promise<{
|
||||
globalConfig: Config.GlobalConfig;
|
||||
configs: Array<Config.ProjectConfig>;
|
||||
hasDeprecationWarnings: boolean;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Reads the jest config, without validating them or filling it out with defaults.
|
||||
* @param config The path to the file or serialized config.
|
||||
* @param param1 Additional options
|
||||
* @returns The raw initial config (not validated)
|
||||
*/
|
||||
export declare function readInitialOptions(
|
||||
config?: string,
|
||||
{
|
||||
packageRootOrConfig,
|
||||
parentConfigDirname,
|
||||
readFromCwd,
|
||||
skipMultipleConfigError,
|
||||
}?: ReadJestConfigOptions,
|
||||
): Promise<{
|
||||
config: Config.InitialOptions;
|
||||
configPath: string | null;
|
||||
}>;
|
||||
|
||||
export declare interface ReadJestConfigOptions {
|
||||
/**
|
||||
* The package root or deserialized config (default is cwd)
|
||||
*/
|
||||
packageRootOrConfig?: string | Config.InitialOptions;
|
||||
/**
|
||||
* When the `packageRootOrConfig` contains config, this parameter should
|
||||
* contain the dirname of the parent config
|
||||
*/
|
||||
parentConfigDirname?: null | string;
|
||||
/**
|
||||
* Indicates whether or not to read the specified config file from disk.
|
||||
* When true, jest will read try to read config from the current working directory.
|
||||
* (default is false)
|
||||
*/
|
||||
readFromCwd?: boolean;
|
||||
/**
|
||||
* Indicates whether or not to ignore the error of jest finding multiple config files.
|
||||
* (default is false)
|
||||
*/
|
||||
skipMultipleConfigError?: boolean;
|
||||
}
|
||||
|
||||
export declare const replaceRootDirInPath: (
|
||||
rootDir: string,
|
||||
filePath: string,
|
||||
) => string;
|
||||
|
||||
export {};
|
||||
494
node_modules/jest-config/build/index.js
generated
vendored
Normal file
494
node_modules/jest-config/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,494 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.constants = void 0;
|
||||
Object.defineProperty(exports, 'defaults', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Defaults.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'deprecationEntries', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Deprecated.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'descriptions', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Descriptions.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isJSONString', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.isJSONString;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'normalize', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _normalize.default;
|
||||
}
|
||||
});
|
||||
exports.readConfig = readConfig;
|
||||
exports.readConfigs = readConfigs;
|
||||
exports.readInitialOptions = readInitialOptions;
|
||||
Object.defineProperty(exports, 'replaceRootDirInPath', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.replaceRootDirInPath;
|
||||
}
|
||||
});
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
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 = _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'));
|
||||
var _Descriptions = _interopRequireDefault(require('./Descriptions'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
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,
|
||||
parentConfigDirname,
|
||||
projectIndex = Infinity,
|
||||
skipMultipleConfigError = false
|
||||
) {
|
||||
const {config: initialOptions, configPath} = await readInitialOptions(
|
||||
argv.config,
|
||||
{
|
||||
packageRootOrConfig,
|
||||
parentConfigDirname,
|
||||
readFromCwd: skipArgvConfigOption,
|
||||
skipMultipleConfigError
|
||||
}
|
||||
);
|
||||
const packageRoot =
|
||||
typeof packageRootOrConfig === 'string'
|
||||
? path().resolve(packageRootOrConfig)
|
||||
: undefined;
|
||||
const {options, hasDeprecationWarnings} = await (0, _normalize.default)(
|
||||
initialOptions,
|
||||
argv,
|
||||
configPath,
|
||||
projectIndex,
|
||||
skipArgvConfigOption && !(packageRoot === parentConfigDirname)
|
||||
);
|
||||
const {globalConfig, projectConfig} = groupOptions(options);
|
||||
return {
|
||||
configPath,
|
||||
globalConfig,
|
||||
hasDeprecationWarnings,
|
||||
projectConfig
|
||||
};
|
||||
}
|
||||
const groupOptions = options => ({
|
||||
globalConfig: Object.freeze({
|
||||
bail: options.bail,
|
||||
changedFilesWithAncestor: options.changedFilesWithAncestor,
|
||||
changedSince: options.changedSince,
|
||||
ci: options.ci,
|
||||
collectCoverage: options.collectCoverage,
|
||||
collectCoverageFrom: options.collectCoverageFrom,
|
||||
coverageDirectory: options.coverageDirectory,
|
||||
coverageProvider: options.coverageProvider,
|
||||
coverageReporters: options.coverageReporters,
|
||||
coverageThreshold: options.coverageThreshold,
|
||||
detectLeaks: options.detectLeaks,
|
||||
detectOpenHandles: options.detectOpenHandles,
|
||||
errorOnDeprecated: options.errorOnDeprecated,
|
||||
expand: options.expand,
|
||||
filter: options.filter,
|
||||
findRelatedTests: options.findRelatedTests,
|
||||
forceExit: options.forceExit,
|
||||
globalSetup: options.globalSetup,
|
||||
globalTeardown: options.globalTeardown,
|
||||
json: options.json,
|
||||
lastCommit: options.lastCommit,
|
||||
listTests: options.listTests,
|
||||
logHeapUsage: options.logHeapUsage,
|
||||
maxConcurrency: options.maxConcurrency,
|
||||
maxWorkers: options.maxWorkers,
|
||||
noSCM: undefined,
|
||||
noStackTrace: options.noStackTrace,
|
||||
nonFlagArgs: options.nonFlagArgs,
|
||||
notify: options.notify,
|
||||
notifyMode: options.notifyMode,
|
||||
onlyChanged: options.onlyChanged,
|
||||
onlyFailures: options.onlyFailures,
|
||||
openHandlesTimeout: options.openHandlesTimeout,
|
||||
outputFile: options.outputFile,
|
||||
passWithNoTests: options.passWithNoTests,
|
||||
projects: options.projects,
|
||||
randomize: options.randomize,
|
||||
replname: options.replname,
|
||||
reporters: options.reporters,
|
||||
rootDir: options.rootDir,
|
||||
runInBand: options.runInBand,
|
||||
runTestsByPath: options.runTestsByPath,
|
||||
seed: options.seed,
|
||||
shard: options.shard,
|
||||
showSeed: options.showSeed,
|
||||
silent: options.silent,
|
||||
skipFilter: options.skipFilter,
|
||||
snapshotFormat: options.snapshotFormat,
|
||||
testFailureExitCode: options.testFailureExitCode,
|
||||
testNamePattern: options.testNamePattern,
|
||||
testPathPattern: options.testPathPattern,
|
||||
testResultsProcessor: options.testResultsProcessor,
|
||||
testSequencer: options.testSequencer,
|
||||
testTimeout: options.testTimeout,
|
||||
updateSnapshot: options.updateSnapshot,
|
||||
useStderr: options.useStderr,
|
||||
verbose: options.verbose,
|
||||
watch: options.watch,
|
||||
watchAll: options.watchAll,
|
||||
watchPlugins: options.watchPlugins,
|
||||
watchman: options.watchman,
|
||||
workerIdleMemoryLimit: options.workerIdleMemoryLimit,
|
||||
workerThreads: options.workerThreads
|
||||
}),
|
||||
projectConfig: Object.freeze({
|
||||
automock: options.automock,
|
||||
cache: options.cache,
|
||||
cacheDirectory: options.cacheDirectory,
|
||||
clearMocks: options.clearMocks,
|
||||
collectCoverageFrom: options.collectCoverageFrom,
|
||||
coverageDirectory: options.coverageDirectory,
|
||||
coveragePathIgnorePatterns: options.coveragePathIgnorePatterns,
|
||||
cwd: options.cwd,
|
||||
dependencyExtractor: options.dependencyExtractor,
|
||||
detectLeaks: options.detectLeaks,
|
||||
detectOpenHandles: options.detectOpenHandles,
|
||||
displayName: options.displayName,
|
||||
errorOnDeprecated: options.errorOnDeprecated,
|
||||
extensionsToTreatAsEsm: options.extensionsToTreatAsEsm,
|
||||
fakeTimers: options.fakeTimers,
|
||||
filter: options.filter,
|
||||
forceCoverageMatch: options.forceCoverageMatch,
|
||||
globalSetup: options.globalSetup,
|
||||
globalTeardown: options.globalTeardown,
|
||||
globals: options.globals,
|
||||
haste: options.haste,
|
||||
id: options.id,
|
||||
injectGlobals: options.injectGlobals,
|
||||
moduleDirectories: options.moduleDirectories,
|
||||
moduleFileExtensions: options.moduleFileExtensions,
|
||||
moduleNameMapper: options.moduleNameMapper,
|
||||
modulePathIgnorePatterns: options.modulePathIgnorePatterns,
|
||||
modulePaths: options.modulePaths,
|
||||
openHandlesTimeout: options.openHandlesTimeout,
|
||||
prettierPath: options.prettierPath,
|
||||
resetMocks: options.resetMocks,
|
||||
resetModules: options.resetModules,
|
||||
resolver: options.resolver,
|
||||
restoreMocks: options.restoreMocks,
|
||||
rootDir: options.rootDir,
|
||||
roots: options.roots,
|
||||
runner: options.runner,
|
||||
runtime: options.runtime,
|
||||
sandboxInjectedGlobals: options.sandboxInjectedGlobals,
|
||||
setupFiles: options.setupFiles,
|
||||
setupFilesAfterEnv: options.setupFilesAfterEnv,
|
||||
skipFilter: options.skipFilter,
|
||||
skipNodeResolution: options.skipNodeResolution,
|
||||
slowTestThreshold: options.slowTestThreshold,
|
||||
snapshotFormat: options.snapshotFormat,
|
||||
snapshotResolver: options.snapshotResolver,
|
||||
snapshotSerializers: options.snapshotSerializers,
|
||||
testEnvironment: options.testEnvironment,
|
||||
testEnvironmentOptions: options.testEnvironmentOptions,
|
||||
testLocationInResults: options.testLocationInResults,
|
||||
testMatch: options.testMatch,
|
||||
testPathIgnorePatterns: options.testPathIgnorePatterns,
|
||||
testRegex: options.testRegex,
|
||||
testRunner: options.testRunner,
|
||||
transform: options.transform,
|
||||
transformIgnorePatterns: options.transformIgnorePatterns,
|
||||
unmockedModulePathPatterns: options.unmockedModulePathPatterns,
|
||||
watchPathIgnorePatterns: options.watchPathIgnorePatterns
|
||||
})
|
||||
});
|
||||
const ensureNoDuplicateConfigs = (parsedConfigs, projects) => {
|
||||
if (projects.length <= 1) {
|
||||
return;
|
||||
}
|
||||
const configPathMap = new Map();
|
||||
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)
|
||||
)}:
|
||||
|
||||
Project 1: ${_chalk().default.bold(
|
||||
projects[parsedConfigs.findIndex(x => x === config)]
|
||||
)}
|
||||
Project 2: ${_chalk().default.bold(
|
||||
projects[parsedConfigs.findIndex(x => x === configPathMap.get(configPath))]
|
||||
)}
|
||||
|
||||
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.
|
||||
`;
|
||||
throw new Error(message);
|
||||
}
|
||||
if (configPath !== null) {
|
||||
configPathMap.set(configPath, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Reads the jest config, without validating them or filling it out with defaults.
|
||||
* @param config The path to the file or serialized config.
|
||||
* @param param1 Additional options
|
||||
* @returns The raw initial config (not validated)
|
||||
*/
|
||||
async function readInitialOptions(
|
||||
config,
|
||||
{
|
||||
packageRootOrConfig = process.cwd(),
|
||||
parentConfigDirname = null,
|
||||
readFromCwd = false,
|
||||
skipMultipleConfigError = false
|
||||
} = {}
|
||||
) {
|
||||
if (typeof packageRootOrConfig !== 'string') {
|
||||
if (parentConfigDirname) {
|
||||
const rawOptions = packageRootOrConfig;
|
||||
rawOptions.rootDir = rawOptions.rootDir
|
||||
? (0, _utils.replaceRootDirInPath)(
|
||||
parentConfigDirname,
|
||||
rawOptions.rootDir
|
||||
)
|
||||
: parentConfigDirname;
|
||||
return {
|
||||
config: rawOptions,
|
||||
configPath: null
|
||||
};
|
||||
} else {
|
||||
throw new Error(
|
||||
'Jest: Cannot use configuration as an object without a file path.'
|
||||
);
|
||||
}
|
||||
}
|
||||
if ((0, _utils.isJSONString)(config)) {
|
||||
try {
|
||||
// A JSON string was passed to `--config` argument and we can parse it
|
||||
// and use as is.
|
||||
const initialOptions = JSON.parse(config);
|
||||
// NOTE: we might need to resolve this dir to an absolute path in the future
|
||||
initialOptions.rootDir = initialOptions.rootDir || packageRootOrConfig;
|
||||
return {
|
||||
config: initialOptions,
|
||||
configPath: null
|
||||
};
|
||||
} catch {
|
||||
throw new Error(
|
||||
'There was an error while parsing the `--config` argument as a JSON string.'
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!readFromCwd && typeof config == 'string') {
|
||||
// A string passed to `--config`, which is either a direct path to the config
|
||||
// or a path to directory containing `package.json`, `jest.config.js` or `jest.config.ts`
|
||||
const configPath = (0, _resolveConfigPath.default)(
|
||||
config,
|
||||
process.cwd(),
|
||||
skipMultipleConfigError
|
||||
);
|
||||
return {
|
||||
config: await (0, _readConfigFileAndSetRootDir.default)(configPath),
|
||||
configPath
|
||||
};
|
||||
}
|
||||
// Otherwise just try to find config in the current rootDir.
|
||||
const configPath = (0, _resolveConfigPath.default)(
|
||||
packageRootOrConfig,
|
||||
process.cwd(),
|
||||
skipMultipleConfigError
|
||||
);
|
||||
return {
|
||||
config: await (0, _readConfigFileAndSetRootDir.default)(configPath),
|
||||
configPath
|
||||
};
|
||||
}
|
||||
|
||||
// Possible scenarios:
|
||||
// 1. jest --config config.json
|
||||
// 2. jest --projects p1 p2
|
||||
// 3. jest --projects p1 p2 --config config.json
|
||||
// 4. jest --projects p1
|
||||
// 5. jest
|
||||
//
|
||||
// If no projects are specified, process.cwd() will be used as the default
|
||||
// (and only) project.
|
||||
async function readConfigs(argv, projectPaths) {
|
||||
let globalConfig;
|
||||
let hasDeprecationWarnings;
|
||||
let configs = [];
|
||||
let projects = projectPaths;
|
||||
let configPath;
|
||||
if (projectPaths.length === 1) {
|
||||
const parsedConfig = await readConfig(argv, projects[0]);
|
||||
configPath = parsedConfig.configPath;
|
||||
hasDeprecationWarnings = parsedConfig.hasDeprecationWarnings;
|
||||
globalConfig = parsedConfig.globalConfig;
|
||||
configs = [parsedConfig.projectConfig];
|
||||
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 > 0) {
|
||||
const cwd =
|
||||
process.platform === 'win32'
|
||||
? (0, _jestUtil().tryRealpath)(process.cwd())
|
||||
: process.cwd();
|
||||
const projectIsCwd = projects[0] === 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) => {
|
||||
const projectIsTheOnlyProject =
|
||||
projectIndex === 0 && projects.length === 1;
|
||||
const skipArgvConfigOption = !(
|
||||
projectIsTheOnlyProject && projectIsCwd
|
||||
);
|
||||
return readConfig(
|
||||
argv,
|
||||
root,
|
||||
skipArgvConfigOption,
|
||||
configPath ? path().dirname(configPath) : cwd,
|
||||
projectIndex,
|
||||
// we wanna skip the warning if this is the "main" project
|
||||
projectIsCwd
|
||||
);
|
||||
})
|
||||
);
|
||||
ensureNoDuplicateConfigs(parsedConfigs, projects);
|
||||
configs = parsedConfigs.map(({projectConfig}) => projectConfig);
|
||||
if (!hasDeprecationWarnings) {
|
||||
hasDeprecationWarnings = parsedConfigs.some(
|
||||
({hasDeprecationWarnings}) => !!hasDeprecationWarnings
|
||||
);
|
||||
}
|
||||
// If no config was passed initially, use the one from the first project
|
||||
if (!globalConfig) {
|
||||
globalConfig = parsedConfigs[0].globalConfig;
|
||||
}
|
||||
}
|
||||
if (!globalConfig || !configs.length) {
|
||||
throw new Error('jest: No configuration found for any project.');
|
||||
}
|
||||
return {
|
||||
configs,
|
||||
globalConfig,
|
||||
hasDeprecationWarnings: !!hasDeprecationWarnings
|
||||
};
|
||||
}
|
||||
1180
node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
1180
node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
node_modules/jest-config/build/parseShardPair.js
generated
vendored
Normal file
41
node_modules/jest-config/build/parseShardPair.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.parseShardPair = void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const parseShardPair = pair => {
|
||||
const shardPair = pair
|
||||
.split('/')
|
||||
.filter(d => /^\d+$/.test(d))
|
||||
.map(d => parseInt(d, 10))
|
||||
.filter(shard => !Number.isNaN(shard));
|
||||
const [shardIndex, shardCount] = shardPair;
|
||||
if (shardPair.length !== 2) {
|
||||
throw new Error(
|
||||
'The shard option requires a string in the format of <n>/<m>.'
|
||||
);
|
||||
}
|
||||
if (shardIndex === 0 || shardCount === 0) {
|
||||
throw new Error(
|
||||
'The shard option requires 1-based values, received 0 or lower in the pair.'
|
||||
);
|
||||
}
|
||||
if (shardIndex > shardCount) {
|
||||
throw new Error(
|
||||
'The shard option <n>/<m> requires <n> to be lower or equal than <m>.'
|
||||
);
|
||||
}
|
||||
return {
|
||||
shardCount,
|
||||
shardIndex
|
||||
};
|
||||
};
|
||||
exports.parseShardPair = parseShardPair;
|
||||
195
node_modules/jest-config/build/readConfigFileAndSetRootDir.js
generated
vendored
Normal file
195
node_modules/jest-config/build/readConfigFileAndSetRootDir.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = readConfigFileAndSetRootDir;
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _parseJson() {
|
||||
const data = _interopRequireDefault(require('parse-json'));
|
||||
_parseJson = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _stripJsonComments() {
|
||||
const data = _interopRequireDefault(require('strip-json-comments'));
|
||||
_stripJsonComments = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _constants = require('./constants');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Read the configuration and set its `rootDir`
|
||||
// 1. If it's a `package.json` file, we look into its "jest" property
|
||||
// 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 {
|
||||
if (isTS) {
|
||||
configObject = await loadTSConfigFile(configPath);
|
||||
} else if (isJSON) {
|
||||
const fileContent = fs().readFileSync(configPath, 'utf8');
|
||||
configObject = (0, _parseJson().default)(
|
||||
(0, _stripJsonComments().default)(fileContent),
|
||||
configPath
|
||||
);
|
||||
} else {
|
||||
configObject = await (0, _jestUtil().requireOrImportModule)(configPath);
|
||||
}
|
||||
} catch (error) {
|
||||
if (isTS) {
|
||||
throw new Error(
|
||||
`Jest: Failed to parse the TypeScript config file ${configPath}\n` +
|
||||
` ${error}`
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
if (configPath.endsWith(_constants.PACKAGE_JSON)) {
|
||||
// Event if there's no "jest" property in package.json we will still use
|
||||
// an empty object.
|
||||
configObject = configObject.jest || {};
|
||||
}
|
||||
if (typeof configObject === 'function') {
|
||||
configObject = await configObject();
|
||||
}
|
||||
if (configObject.rootDir) {
|
||||
// We don't touch it if it has an absolute path specified
|
||||
if (!path().isAbsolute(configObject.rootDir)) {
|
||||
// otherwise, we'll resolve it relative to the file's __dirname
|
||||
configObject = {
|
||||
...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 = {
|
||||
...configObject,
|
||||
rootDir: path().dirname(configPath)
|
||||
};
|
||||
}
|
||||
return configObject;
|
||||
}
|
||||
|
||||
// Load the TypeScript configuration
|
||||
const loadTSConfigFile = async configPath => {
|
||||
// Get registered TypeScript compiler instance
|
||||
const registeredCompiler = await getRegisteredCompiler();
|
||||
registeredCompiler.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();
|
||||
}
|
||||
registeredCompiler.enabled(false);
|
||||
return configObject;
|
||||
};
|
||||
let registeredCompilerPromise;
|
||||
function getRegisteredCompiler() {
|
||||
// Cache the promise to avoid multiple registrations
|
||||
registeredCompilerPromise = registeredCompilerPromise ?? registerTsNode();
|
||||
return registeredCompilerPromise;
|
||||
}
|
||||
async function registerTsNode() {
|
||||
try {
|
||||
// Register TypeScript compiler instance
|
||||
const tsNode = await import('ts-node');
|
||||
return tsNode.register({
|
||||
compilerOptions: {
|
||||
module: 'CommonJS'
|
||||
},
|
||||
moduleTypes: {
|
||||
'**': 'cjs'
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.code === 'ERR_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;
|
||||
}
|
||||
}
|
||||
217
node_modules/jest-config/build/resolveConfigPath.js
generated
vendored
Normal file
217
node_modules/jest-config/build/resolveConfigPath.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = resolveConfigPath;
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _constants = require('./constants');
|
||||
var _utils = require('./utils');
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const isFile = filePath =>
|
||||
fs().existsSync(filePath) && !fs().lstatSync(filePath).isDirectory();
|
||||
const getConfigFilename = ext => _constants.JEST_CONFIG_BASE_NAME + ext;
|
||||
function resolveConfigPath(
|
||||
pathToResolve,
|
||||
cwd,
|
||||
skipMultipleConfigError = false
|
||||
) {
|
||||
if (!path().isAbsolute(cwd)) {
|
||||
throw new Error(`"cwd" must be an absolute path. cwd: ${cwd}`);
|
||||
}
|
||||
const absolutePath = path().isAbsolute(pathToResolve)
|
||||
? pathToResolve
|
||||
: path().resolve(cwd, pathToResolve);
|
||||
if (isFile(absolutePath)) {
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
// This is a guard against passing non existing path as a project/config,
|
||||
// that will otherwise result in a very confusing situation.
|
||||
// e.g.
|
||||
// With a directory structure like this:
|
||||
// my_project/
|
||||
// package.json
|
||||
//
|
||||
// Passing a `my_project/some_directory_that_doesnt_exist` as a project
|
||||
// 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().existsSync(absolutePath)) {
|
||||
throw new Error(
|
||||
"Can't find a root directory while resolving a config file path.\n" +
|
||||
`Provided path to resolve: ${pathToResolve}\n` +
|
||||
`cwd: ${cwd}`
|
||||
);
|
||||
}
|
||||
return resolveConfigPathByTraversing(
|
||||
absolutePath,
|
||||
pathToResolve,
|
||||
cwd,
|
||||
skipMultipleConfigError
|
||||
);
|
||||
}
|
||||
const resolveConfigPathByTraversing = (
|
||||
pathToResolve,
|
||||
initialPath,
|
||||
cwd,
|
||||
skipMultipleConfigError
|
||||
) => {
|
||||
const configFiles = _constants.JEST_CONFIG_EXT_ORDER.map(ext =>
|
||||
path().resolve(pathToResolve, getConfigFilename(ext))
|
||||
).filter(isFile);
|
||||
const packageJson = findPackageJson(pathToResolve);
|
||||
if (packageJson && hasPackageJsonJestKey(packageJson)) {
|
||||
configFiles.push(packageJson);
|
||||
}
|
||||
if (!skipMultipleConfigError && configFiles.length > 1) {
|
||||
throw new (_jestValidate().ValidationError)(
|
||||
...makeMultipleConfigsErrorMessage(configFiles)
|
||||
);
|
||||
}
|
||||
if (configFiles.length > 0 || packageJson) {
|
||||
return configFiles[0] ?? packageJson;
|
||||
}
|
||||
|
||||
// This is the system root.
|
||||
// We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
|
||||
if (pathToResolve === path().dirname(pathToResolve)) {
|
||||
throw new Error(makeResolutionErrorMessage(initialPath, cwd));
|
||||
}
|
||||
|
||||
// go up a level and try it again
|
||||
return resolveConfigPathByTraversing(
|
||||
path().dirname(pathToResolve),
|
||||
initialPath,
|
||||
cwd,
|
||||
skipMultipleConfigError
|
||||
);
|
||||
};
|
||||
const findPackageJson = pathToResolve => {
|
||||
const packagePath = path().resolve(pathToResolve, _constants.PACKAGE_JSON);
|
||||
if (isFile(packagePath)) {
|
||||
return packagePath;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const hasPackageJsonJestKey = packagePath => {
|
||||
const content = fs().readFileSync(packagePath, 'utf8');
|
||||
try {
|
||||
return 'jest' in JSON.parse(content);
|
||||
} catch {
|
||||
// If package is not a valid JSON
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const makeResolutionErrorMessage = (initialPath, cwd) =>
|
||||
'Could not find a config file based on provided values:\n' +
|
||||
`path: "${initialPath}"\n` +
|
||||
`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 one of those files in exact order: ${_constants.JEST_CONFIG_EXT_ORDER.map(
|
||||
ext => `"${getConfigFilename(ext)}"`
|
||||
).join(' or ')}.`;
|
||||
function extraIfPackageJson(configPath) {
|
||||
if (configPath.endsWith(_constants.PACKAGE_JSON)) {
|
||||
return '`jest` key in ';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
const makeMultipleConfigsErrorMessage = configPaths => [
|
||||
`${_utils.BULLET}${_chalk().default.bold('Multiple configurations found')}`,
|
||||
[
|
||||
...configPaths.map(
|
||||
configPath =>
|
||||
` * ${extraIfPackageJson(configPath)}${(0, _slash().default)(
|
||||
configPath
|
||||
)}`
|
||||
),
|
||||
'',
|
||||
' Implicit config resolution does not allow multiple configuration files.',
|
||||
' Either remove unused config files or select one explicitly with `--config`.'
|
||||
].join('\n'),
|
||||
_utils.DOCUMENTATION_NOTE
|
||||
];
|
||||
58
node_modules/jest-config/build/setFromArgv.js
generated
vendored
Normal file
58
node_modules/jest-config/build/setFromArgv.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = setFromArgv;
|
||||
var _utils = require('./utils');
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const specialArgs = ['_', '$0', 'h', 'help', 'config'];
|
||||
function setFromArgv(options, argv) {
|
||||
const argvToOptions = Object.keys(argv).reduce((options, key) => {
|
||||
if (argv[key] === undefined || specialArgs.includes(key)) {
|
||||
return options;
|
||||
}
|
||||
switch (key) {
|
||||
case 'coverage':
|
||||
options.collectCoverage = argv[key];
|
||||
break;
|
||||
case 'json':
|
||||
options.useStderr = argv[key];
|
||||
break;
|
||||
case 'watchAll':
|
||||
options.watch = false;
|
||||
options.watchAll = argv[key];
|
||||
break;
|
||||
case 'env':
|
||||
options.testEnvironment = argv[key];
|
||||
break;
|
||||
case 'config':
|
||||
break;
|
||||
case 'coverageThreshold':
|
||||
case 'globals':
|
||||
case 'haste':
|
||||
case 'moduleNameMapper':
|
||||
case 'testEnvironmentOptions':
|
||||
case 'transform':
|
||||
const str = argv[key];
|
||||
if ((0, _utils.isJSONString)(str)) {
|
||||
options[key] = JSON.parse(str);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
options[key] = argv[key];
|
||||
}
|
||||
return options;
|
||||
}, {});
|
||||
return {
|
||||
...options,
|
||||
...((0, _utils.isJSONString)(argv.config) ? JSON.parse(argv.config) : null),
|
||||
...argvToOptions
|
||||
};
|
||||
}
|
||||
79
node_modules/jest-config/build/stringToBytes.js
generated
vendored
Normal file
79
node_modules/jest-config/build/stringToBytes.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Converts a string representing an amount of memory to bytes.
|
||||
*
|
||||
* @param input The value to convert to bytes.
|
||||
* @param percentageReference The reference value to use when a '%' value is supplied.
|
||||
*/
|
||||
function stringToBytes(input, percentageReference) {
|
||||
if (input === null || input === undefined) {
|
||||
return input;
|
||||
}
|
||||
if (typeof input === 'string') {
|
||||
if (isNaN(Number.parseFloat(input.slice(-1)))) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let [, numericString, trailingChars] =
|
||||
input.match(/(.*?)([^0-9.-]+)$/i) || [];
|
||||
if (trailingChars && numericString) {
|
||||
const numericValue = Number.parseFloat(numericString);
|
||||
trailingChars = trailingChars.toLowerCase();
|
||||
switch (trailingChars) {
|
||||
case '%':
|
||||
input = numericValue / 100;
|
||||
break;
|
||||
case 'kb':
|
||||
case 'k':
|
||||
return numericValue * 1000;
|
||||
case 'kib':
|
||||
return numericValue * 1024;
|
||||
case 'mb':
|
||||
case 'm':
|
||||
return numericValue * 1000 * 1000;
|
||||
case 'mib':
|
||||
return numericValue * 1024 * 1024;
|
||||
case 'gb':
|
||||
case 'g':
|
||||
return numericValue * 1000 * 1000 * 1000;
|
||||
case 'gib':
|
||||
return numericValue * 1024 * 1024 * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
// It ends in some kind of char so we need to do some parsing
|
||||
} else {
|
||||
input = Number.parseFloat(input);
|
||||
}
|
||||
}
|
||||
if (typeof input === 'number') {
|
||||
if (input <= 1 && input > 0) {
|
||||
if (percentageReference) {
|
||||
return Math.floor(input * percentageReference);
|
||||
} else {
|
||||
throw new Error(
|
||||
'For a percentage based memory limit a percentageReference must be supplied'
|
||||
);
|
||||
}
|
||||
} else if (input > 1) {
|
||||
return Math.floor(input);
|
||||
} else {
|
||||
throw new Error('Unexpected numerical input');
|
||||
}
|
||||
}
|
||||
throw new Error('Unexpected input');
|
||||
}
|
||||
|
||||
// https://github.com/import-js/eslint-plugin-import/issues/1590
|
||||
var _default = stringToBytes;
|
||||
exports.default = _default;
|
||||
172
node_modules/jest-config/build/utils.js
generated
vendored
Normal file
172
node_modules/jest-config/build/utils.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.resolve =
|
||||
exports.replaceRootDirInPath =
|
||||
exports.isJSONString =
|
||||
exports.escapeGlobCharacters =
|
||||
exports._replaceRootDirTags =
|
||||
exports.DOCUMENTATION_NOTE =
|
||||
exports.BULLET =
|
||||
void 0;
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('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;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function (nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const BULLET = _chalk().default.bold('\u25cf ');
|
||||
exports.BULLET = BULLET;
|
||||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
|
||||
'Configuration Documentation:'
|
||||
)}
|
||||
https://jestjs.io/docs/configuration
|
||||
`;
|
||||
exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE;
|
||||
const createValidationError = message =>
|
||||
new (_jestValidate().ValidationError)(
|
||||
`${BULLET}Validation Error`,
|
||||
message,
|
||||
DOCUMENTATION_NOTE
|
||||
);
|
||||
const resolve = (resolver, {key, filePath, rootDir, optional}) => {
|
||||
const module = _jestResolve().default.findNodeModule(
|
||||
replaceRootDirInPath(rootDir, filePath),
|
||||
{
|
||||
basedir: rootDir,
|
||||
resolver: resolver || undefined
|
||||
}
|
||||
);
|
||||
if (!module && !optional) {
|
||||
throw createValidationError(` Module ${_chalk().default.bold(
|
||||
filePath
|
||||
)} in the ${_chalk().default.bold(key)} option was not found.
|
||||
${_chalk().default.bold('<rootDir>')} is: ${rootDir}`);
|
||||
}
|
||||
/// can cast as string since nulls will be thrown
|
||||
return module;
|
||||
};
|
||||
exports.resolve = resolve;
|
||||
const escapeGlobCharacters = path => path.replace(/([()*{}[\]!?\\])/g, '\\$1');
|
||||
exports.escapeGlobCharacters = escapeGlobCharacters;
|
||||
const replaceRootDirInPath = (rootDir, filePath) => {
|
||||
if (!/^<rootDir>/.test(filePath)) {
|
||||
return filePath;
|
||||
}
|
||||
return path().resolve(
|
||||
rootDir,
|
||||
path().normalize(`./${filePath.substring('<rootDir>'.length)}`)
|
||||
);
|
||||
};
|
||||
exports.replaceRootDirInPath = replaceRootDirInPath;
|
||||
const _replaceRootDirInObject = (rootDir, config) => {
|
||||
const newConfig = {};
|
||||
for (const configKey in config) {
|
||||
newConfig[configKey] =
|
||||
configKey === 'rootDir'
|
||||
? config[configKey]
|
||||
: _replaceRootDirTags(rootDir, config[configKey]);
|
||||
}
|
||||
return newConfig;
|
||||
};
|
||||
const _replaceRootDirTags = (rootDir, config) => {
|
||||
if (config == null) {
|
||||
return config;
|
||||
}
|
||||
switch (typeof config) {
|
||||
case 'object':
|
||||
if (Array.isArray(config)) {
|
||||
/// can be string[] or {}[]
|
||||
return config.map(item => _replaceRootDirTags(rootDir, item));
|
||||
}
|
||||
if (config instanceof RegExp) {
|
||||
return config;
|
||||
}
|
||||
return _replaceRootDirInObject(rootDir, config);
|
||||
case 'string':
|
||||
return replaceRootDirInPath(rootDir, config);
|
||||
}
|
||||
return config;
|
||||
};
|
||||
exports._replaceRootDirTags = _replaceRootDirTags;
|
||||
// newtype
|
||||
const isJSONString = text =>
|
||||
text != null &&
|
||||
typeof text === 'string' &&
|
||||
text.startsWith('{') &&
|
||||
text.endsWith('}');
|
||||
exports.isJSONString = isJSONString;
|
||||
24
node_modules/jest-config/build/validatePattern.js
generated
vendored
Normal file
24
node_modules/jest-config/build/validatePattern.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = validatePattern;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
function validatePattern(pattern) {
|
||||
if (pattern) {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new RegExp(pattern, 'i');
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
21
node_modules/jest-config/node_modules/glob/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/node_modules/glob/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
## Glob Logo
|
||||
|
||||
Glob's logo created by Tanya Brassie <http://tanyabrassie.com/>, licensed
|
||||
under a Creative Commons Attribution-ShareAlike 4.0 International License
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
378
node_modules/jest-config/node_modules/glob/README.md
generated
vendored
Normal file
378
node_modules/jest-config/node_modules/glob/README.md
generated
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
# Glob
|
||||
|
||||
Match files using the patterns the shell uses, like stars and stuff.
|
||||
|
||||
[](https://travis-ci.org/isaacs/node-glob/) [](https://ci.appveyor.com/project/isaacs/node-glob) [](https://coveralls.io/github/isaacs/node-glob?branch=master)
|
||||
|
||||
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||
library to do its matching.
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
Install with npm
|
||||
|
||||
```
|
||||
npm i glob
|
||||
```
|
||||
|
||||
```javascript
|
||||
var glob = require("glob")
|
||||
|
||||
// options is optional
|
||||
glob("**/*.js", options, function (er, files) {
|
||||
// files is an array of filenames.
|
||||
// If the `nonull` option is set, and nothing
|
||||
// was found, then files is ["**/*.js"]
|
||||
// er is an error object or null.
|
||||
})
|
||||
```
|
||||
|
||||
## Glob Primer
|
||||
|
||||
"Globs" are the patterns you type when you do stuff like `ls *.js` on
|
||||
the command line, or put `build/*` in a `.gitignore` file.
|
||||
|
||||
Before parsing the path part patterns, braced sections are expanded
|
||||
into a set. Braced sections start with `{` and end with `}`, with any
|
||||
number of comma-delimited sections within. Braced sections may contain
|
||||
slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
|
||||
|
||||
The following characters have special magic meaning when used in a
|
||||
path portion:
|
||||
|
||||
* `*` Matches 0 or more characters in a single path portion
|
||||
* `?` Matches 1 character
|
||||
* `[...]` Matches a range of characters, similar to a RegExp range.
|
||||
If the first character of the range is `!` or `^` then it matches
|
||||
any character not in the range.
|
||||
* `!(pattern|pattern|pattern)` Matches anything that does not match
|
||||
any of the patterns provided.
|
||||
* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
|
||||
patterns provided.
|
||||
* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
|
||||
patterns provided.
|
||||
* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
|
||||
* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
|
||||
provided
|
||||
* `**` If a "globstar" is alone in a path portion, then it matches
|
||||
zero or more directories and subdirectories searching for matches.
|
||||
It does not crawl symlinked directories.
|
||||
|
||||
### Dots
|
||||
|
||||
If a file or directory path portion has a `.` as the first character,
|
||||
then it will not match any glob pattern unless that pattern's
|
||||
corresponding path part also has a `.` as its first character.
|
||||
|
||||
For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
|
||||
However the pattern `a/*/c` would not, because `*` does not start with
|
||||
a dot character.
|
||||
|
||||
You can make glob treat dots as normal characters by setting
|
||||
`dot:true` in the options.
|
||||
|
||||
### Basename Matching
|
||||
|
||||
If you set `matchBase:true` in the options, and the pattern has no
|
||||
slashes in it, then it will seek for any file anywhere in the tree
|
||||
with a matching basename. For example, `*.js` would match
|
||||
`test/simple/basic.js`.
|
||||
|
||||
### Empty Sets
|
||||
|
||||
If no matching files are found, then an empty array is returned. This
|
||||
differs from the shell, where the pattern itself is returned. For
|
||||
example:
|
||||
|
||||
$ echo a*s*d*f
|
||||
a*s*d*f
|
||||
|
||||
To get the bash-style behavior, set the `nonull:true` in the options.
|
||||
|
||||
### See Also:
|
||||
|
||||
* `man sh`
|
||||
* `man bash` (Search for "Pattern Matching")
|
||||
* `man 3 fnmatch`
|
||||
* `man 5 gitignore`
|
||||
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||
|
||||
## glob.hasMagic(pattern, [options])
|
||||
|
||||
Returns `true` if there are any special characters in the pattern, and
|
||||
`false` otherwise.
|
||||
|
||||
Note that the options affect the results. If `noext:true` is set in
|
||||
the options object, then `+(a|b)` will not be considered a magic
|
||||
pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`
|
||||
then that is considered magical, unless `nobrace:true` is set in the
|
||||
options.
|
||||
|
||||
## glob(pattern, [options], cb)
|
||||
|
||||
* `pattern` `{String}` Pattern to be matched
|
||||
* `options` `{Object}`
|
||||
* `cb` `{Function}`
|
||||
* `err` `{Error | null}`
|
||||
* `matches` `{Array<String>}` filenames found matching the pattern
|
||||
|
||||
Perform an asynchronous glob search.
|
||||
|
||||
## glob.sync(pattern, [options])
|
||||
|
||||
* `pattern` `{String}` Pattern to be matched
|
||||
* `options` `{Object}`
|
||||
* return: `{Array<String>}` filenames found matching the pattern
|
||||
|
||||
Perform a synchronous glob search.
|
||||
|
||||
## Class: glob.Glob
|
||||
|
||||
Create a Glob object by instantiating the `glob.Glob` class.
|
||||
|
||||
```javascript
|
||||
var Glob = require("glob").Glob
|
||||
var mg = new Glob(pattern, options, cb)
|
||||
```
|
||||
|
||||
It's an EventEmitter, and starts walking the filesystem to find matches
|
||||
immediately.
|
||||
|
||||
### new glob.Glob(pattern, [options], [cb])
|
||||
|
||||
* `pattern` `{String}` pattern to search for
|
||||
* `options` `{Object}`
|
||||
* `cb` `{Function}` Called when an error occurs, or matches are found
|
||||
* `err` `{Error | null}`
|
||||
* `matches` `{Array<String>}` filenames found matching the pattern
|
||||
|
||||
Note that if the `sync` flag is set in the options, then matches will
|
||||
be immediately available on the `g.found` member.
|
||||
|
||||
### Properties
|
||||
|
||||
* `minimatch` The minimatch object that the glob uses.
|
||||
* `options` The options object passed in.
|
||||
* `aborted` Boolean which is set to true when calling `abort()`. There
|
||||
is no way at this time to continue a glob search after aborting, but
|
||||
you can re-use the statCache to avoid having to duplicate syscalls.
|
||||
* `cache` Convenience object. Each field has the following possible
|
||||
values:
|
||||
* `false` - Path does not exist
|
||||
* `true` - Path exists
|
||||
* `'FILE'` - Path exists, and is not a directory
|
||||
* `'DIR'` - Path exists, and is a directory
|
||||
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||
array value is the results of `fs.readdir`
|
||||
* `statCache` Cache of `fs.stat` results, to prevent statting the same
|
||||
path multiple times.
|
||||
* `symlinks` A record of which paths are symbolic links, which is
|
||||
relevant in resolving `**` patterns.
|
||||
* `realpathCache` An optional object which is passed to `fs.realpath`
|
||||
to minimize unnecessary syscalls. It is stored on the instantiated
|
||||
Glob object, and may be re-used.
|
||||
|
||||
### Events
|
||||
|
||||
* `end` When the matching is finished, this is emitted with all the
|
||||
matches found. If the `nonull` option is set, and no match was found,
|
||||
then the `matches` list contains the original pattern. The matches
|
||||
are sorted, unless the `nosort` flag is set.
|
||||
* `match` Every time a match is found, this is emitted with the specific
|
||||
thing that matched. It is not deduplicated or resolved to a realpath.
|
||||
* `error` Emitted when an unexpected error is encountered, or whenever
|
||||
any fs error occurs if `options.strict` is set.
|
||||
* `abort` When `abort()` is called, this event is raised.
|
||||
|
||||
### Methods
|
||||
|
||||
* `pause` Temporarily stop the search
|
||||
* `resume` Resume the search
|
||||
* `abort` Stop the search forever
|
||||
|
||||
### Options
|
||||
|
||||
All the options that can be passed to Minimatch can also be passed to
|
||||
Glob to change pattern matching behavior. Also, some have been added,
|
||||
or have glob-specific ramifications.
|
||||
|
||||
All options are false by default, unless otherwise noted.
|
||||
|
||||
All options are added to the Glob object, as well.
|
||||
|
||||
If you are running many `glob` operations, you can pass a Glob object
|
||||
as the `options` argument to a subsequent operation to shortcut some
|
||||
`stat` and `readdir` calls. At the very least, you may pass in shared
|
||||
`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
|
||||
parallel glob operations will be sped up by sharing information about
|
||||
the filesystem.
|
||||
|
||||
* `cwd` The current working directory in which to search. Defaults
|
||||
to `process.cwd()`.
|
||||
* `root` The place where patterns starting with `/` will be mounted
|
||||
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
||||
systems, and `C:\` or some such on Windows.)
|
||||
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
||||
Note that an explicit dot in a portion of the pattern will always
|
||||
match dot files.
|
||||
* `nomount` By default, a pattern starting with a forward-slash will be
|
||||
"mounted" onto the root setting, so that a valid filesystem path is
|
||||
returned. Set this flag to disable that behavior.
|
||||
* `mark` Add a `/` character to directory matches. Note that this
|
||||
requires additional stat calls.
|
||||
* `nosort` Don't sort the results.
|
||||
* `stat` Set to true to stat *all* results. This reduces performance
|
||||
somewhat, and is completely unnecessary, unless `readdir` is presumed
|
||||
to be an untrustworthy indicator of file existence.
|
||||
* `silent` When an unusual error is encountered when attempting to
|
||||
read a directory, a warning will be printed to stderr. Set the
|
||||
`silent` option to true to suppress these warnings.
|
||||
* `strict` When an unusual error is encountered when attempting to
|
||||
read a directory, the process will just continue on in search of
|
||||
other matches. Set the `strict` option to raise an error in these
|
||||
cases.
|
||||
* `cache` See `cache` property above. Pass in a previously generated
|
||||
cache object to save some fs calls.
|
||||
* `statCache` A cache of results of filesystem information, to prevent
|
||||
unnecessary stat calls. While it should not normally be necessary
|
||||
to set this, you may pass the statCache from one glob() call to the
|
||||
options object of another, if you know that the filesystem will not
|
||||
change between calls. (See "Race Conditions" below.)
|
||||
* `symlinks` A cache of known symbolic links. You may pass in a
|
||||
previously generated `symlinks` object to save `lstat` calls when
|
||||
resolving `**` matches.
|
||||
* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
|
||||
* `nounique` In some cases, brace-expanded patterns can result in the
|
||||
same file showing up multiple times in the result set. By default,
|
||||
this implementation prevents duplicates in the result set. Set this
|
||||
flag to disable that behavior.
|
||||
* `nonull` Set to never return an empty set, instead returning a set
|
||||
containing the pattern itself. This is the default in glob(3).
|
||||
* `debug` Set to enable debug logging in minimatch and glob.
|
||||
* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||
* `noglobstar` Do not match `**` against multiple filenames. (Ie,
|
||||
treat it as a normal `*` instead.)
|
||||
* `noext` Do not match `+(a|b)` "extglob" patterns.
|
||||
* `nocase` Perform a case-insensitive match. Note: on
|
||||
case-insensitive filesystems, non-magic patterns will match by
|
||||
default, since `stat` and `readdir` will not raise errors.
|
||||
* `matchBase` Perform a basename-only match if the pattern does not
|
||||
contain any slash characters. That is, `*.js` would be treated as
|
||||
equivalent to `**/*.js`, matching all js files in all directories.
|
||||
* `nodir` Do not match directories, only files. (Note: to match
|
||||
*only* directories, simply put a `/` at the end of the pattern.)
|
||||
* `ignore` Add a pattern or an array of glob patterns to exclude matches.
|
||||
Note: `ignore` patterns are *always* in `dot:true` mode, regardless
|
||||
of any other settings.
|
||||
* `follow` Follow symlinked directories when expanding `**` patterns.
|
||||
Note that this can result in a lot of duplicate references in the
|
||||
presence of cyclic links.
|
||||
* `realpath` Set to true to call `fs.realpath` on all of the results.
|
||||
In the case of a symlink that cannot be resolved, the full absolute
|
||||
path to the matched entry is returned (though it will usually be a
|
||||
broken symlink)
|
||||
* `absolute` Set to true to always receive absolute paths for matched
|
||||
files. Unlike `realpath`, this also affects the values returned in
|
||||
the `match` event.
|
||||
* `fs` File-system object with Node's `fs` API. By default, the built-in
|
||||
`fs` module will be used. Set to a volume provided by a library like
|
||||
`memfs` to avoid using the "real" file-system.
|
||||
|
||||
## Comparisons to other fnmatch/glob implementations
|
||||
|
||||
While strict compliance with the existing standards is a worthwhile
|
||||
goal, some discrepancies exist between node-glob and other
|
||||
implementations, and are intentional.
|
||||
|
||||
The double-star character `**` is supported by default, unless the
|
||||
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||
and bash 4.3, where `**` only has special significance if it is the only
|
||||
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||
`a/**b` will not.
|
||||
|
||||
Note that symlinked directories are not crawled as part of a `**`,
|
||||
though their contents may match against subsequent portions of the
|
||||
pattern. This prevents infinite loops and duplicates and the like.
|
||||
|
||||
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||
then glob returns the pattern as-provided, rather than
|
||||
interpreting the character escapes. For example,
|
||||
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||
that it does not resolve escaped pattern characters.
|
||||
|
||||
If brace expansion is not disabled, then it is performed before any
|
||||
other interpretation of the glob pattern. Thus, a pattern like
|
||||
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||
checked for validity. Since those two are valid, matching proceeds.
|
||||
|
||||
### Comments and Negation
|
||||
|
||||
Previously, this module let you mark a pattern as a "comment" if it
|
||||
started with a `#` character, or a "negated" pattern if it started
|
||||
with a `!` character.
|
||||
|
||||
These options were deprecated in version 5, and removed in version 6.
|
||||
|
||||
To specify things that should not match, use the `ignore` option.
|
||||
|
||||
## Windows
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||
characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes will always
|
||||
be interpreted as escape characters, not path separators.
|
||||
|
||||
Results from absolute patterns such as `/foo/*` are mounted onto the
|
||||
root setting using `path.join`. On windows, this will by default result
|
||||
in `/foo/*` matching `C:\foo\bar.txt`.
|
||||
|
||||
## Race Conditions
|
||||
|
||||
Glob searching, by its very nature, is susceptible to race conditions,
|
||||
since it relies on directory walking and such.
|
||||
|
||||
As a result, it is possible that a file that exists when glob looks for
|
||||
it may have been deleted or modified by the time it returns the result.
|
||||
|
||||
As part of its internal implementation, this program caches all stat
|
||||
and readdir calls that it makes, in order to cut down on system
|
||||
overhead. However, this also makes it even more susceptible to races,
|
||||
especially if the cache or statCache objects are reused between glob
|
||||
calls.
|
||||
|
||||
Users are thus advised not to use a glob result as a guarantee of
|
||||
filesystem state in the face of rapid changes. For the vast majority
|
||||
of operations, this is never a problem.
|
||||
|
||||
## Glob Logo
|
||||
Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo).
|
||||
|
||||
The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
|
||||
|
||||
## Contributing
|
||||
|
||||
Any change to behavior (including bugfixes) must come with a test.
|
||||
|
||||
Patches that fail tests or reduce performance will be rejected.
|
||||
|
||||
```
|
||||
# to run tests
|
||||
npm test
|
||||
|
||||
# to re-generate test fixtures
|
||||
npm run test-regen
|
||||
|
||||
# to benchmark against bash/zsh
|
||||
npm run bench
|
||||
|
||||
# to profile javascript
|
||||
npm run prof
|
||||
```
|
||||
|
||||

|
||||
238
node_modules/jest-config/node_modules/glob/common.js
generated
vendored
Normal file
238
node_modules/jest-config/node_modules/glob/common.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
exports.setopts = setopts
|
||||
exports.ownProp = ownProp
|
||||
exports.makeAbs = makeAbs
|
||||
exports.finish = finish
|
||||
exports.mark = mark
|
||||
exports.isIgnored = isIgnored
|
||||
exports.childrenIgnored = childrenIgnored
|
||||
|
||||
function ownProp (obj, field) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||
}
|
||||
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var minimatch = require("minimatch")
|
||||
var isAbsolute = require("path-is-absolute")
|
||||
var Minimatch = minimatch.Minimatch
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a.localeCompare(b, 'en')
|
||||
}
|
||||
|
||||
function setupIgnores (self, options) {
|
||||
self.ignore = options.ignore || []
|
||||
|
||||
if (!Array.isArray(self.ignore))
|
||||
self.ignore = [self.ignore]
|
||||
|
||||
if (self.ignore.length) {
|
||||
self.ignore = self.ignore.map(ignoreMap)
|
||||
}
|
||||
}
|
||||
|
||||
// ignore patterns are always in dot:true mode.
|
||||
function ignoreMap (pattern) {
|
||||
var gmatcher = null
|
||||
if (pattern.slice(-3) === '/**') {
|
||||
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
||||
gmatcher = new Minimatch(gpattern, { dot: true })
|
||||
}
|
||||
|
||||
return {
|
||||
matcher: new Minimatch(pattern, { dot: true }),
|
||||
gmatcher: gmatcher
|
||||
}
|
||||
}
|
||||
|
||||
function setopts (self, pattern, options) {
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
// base-matching: just use globstar for that.
|
||||
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||
if (options.noglobstar) {
|
||||
throw new Error("base matching requires globstar")
|
||||
}
|
||||
pattern = "**/" + pattern
|
||||
}
|
||||
|
||||
self.silent = !!options.silent
|
||||
self.pattern = pattern
|
||||
self.strict = options.strict !== false
|
||||
self.realpath = !!options.realpath
|
||||
self.realpathCache = options.realpathCache || Object.create(null)
|
||||
self.follow = !!options.follow
|
||||
self.dot = !!options.dot
|
||||
self.mark = !!options.mark
|
||||
self.nodir = !!options.nodir
|
||||
if (self.nodir)
|
||||
self.mark = true
|
||||
self.sync = !!options.sync
|
||||
self.nounique = !!options.nounique
|
||||
self.nonull = !!options.nonull
|
||||
self.nosort = !!options.nosort
|
||||
self.nocase = !!options.nocase
|
||||
self.stat = !!options.stat
|
||||
self.noprocess = !!options.noprocess
|
||||
self.absolute = !!options.absolute
|
||||
self.fs = options.fs || fs
|
||||
|
||||
self.maxLength = options.maxLength || Infinity
|
||||
self.cache = options.cache || Object.create(null)
|
||||
self.statCache = options.statCache || Object.create(null)
|
||||
self.symlinks = options.symlinks || Object.create(null)
|
||||
|
||||
setupIgnores(self, options)
|
||||
|
||||
self.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!ownProp(options, "cwd"))
|
||||
self.cwd = cwd
|
||||
else {
|
||||
self.cwd = path.resolve(options.cwd)
|
||||
self.changedCwd = self.cwd !== cwd
|
||||
}
|
||||
|
||||
self.root = options.root || path.resolve(self.cwd, "/")
|
||||
self.root = path.resolve(self.root)
|
||||
if (process.platform === "win32")
|
||||
self.root = self.root.replace(/\\/g, "/")
|
||||
|
||||
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
||||
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
||||
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
||||
if (process.platform === "win32")
|
||||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
||||
self.nomount = !!options.nomount
|
||||
|
||||
// disable comments and negation in Minimatch.
|
||||
// Note that they are not supported in Glob itself anyway.
|
||||
options.nonegate = true
|
||||
options.nocomment = true
|
||||
// always treat \ in patterns as escapes, not path separators
|
||||
options.allowWindowsEscape = false
|
||||
|
||||
self.minimatch = new Minimatch(pattern, options)
|
||||
self.options = self.minimatch.options
|
||||
}
|
||||
|
||||
function finish (self) {
|
||||
var nou = self.nounique
|
||||
var all = nou ? [] : Object.create(null)
|
||||
|
||||
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
||||
var matches = self.matches[i]
|
||||
if (!matches || Object.keys(matches).length === 0) {
|
||||
if (self.nonull) {
|
||||
// do like the shell, and spit out the literal glob
|
||||
var literal = self.minimatch.globSet[i]
|
||||
if (nou)
|
||||
all.push(literal)
|
||||
else
|
||||
all[literal] = true
|
||||
}
|
||||
} else {
|
||||
// had matches
|
||||
var m = Object.keys(matches)
|
||||
if (nou)
|
||||
all.push.apply(all, m)
|
||||
else
|
||||
m.forEach(function (m) {
|
||||
all[m] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!nou)
|
||||
all = Object.keys(all)
|
||||
|
||||
if (!self.nosort)
|
||||
all = all.sort(alphasort)
|
||||
|
||||
// at *some* point we statted all of these
|
||||
if (self.mark) {
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
all[i] = self._mark(all[i])
|
||||
}
|
||||
if (self.nodir) {
|
||||
all = all.filter(function (e) {
|
||||
var notDir = !(/\/$/.test(e))
|
||||
var c = self.cache[e] || self.cache[makeAbs(self, e)]
|
||||
if (notDir && c)
|
||||
notDir = c !== 'DIR' && !Array.isArray(c)
|
||||
return notDir
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (self.ignore.length)
|
||||
all = all.filter(function(m) {
|
||||
return !isIgnored(self, m)
|
||||
})
|
||||
|
||||
self.found = all
|
||||
}
|
||||
|
||||
function mark (self, p) {
|
||||
var abs = makeAbs(self, p)
|
||||
var c = self.cache[abs]
|
||||
var m = p
|
||||
if (c) {
|
||||
var isDir = c === 'DIR' || Array.isArray(c)
|
||||
var slash = p.slice(-1) === '/'
|
||||
|
||||
if (isDir && !slash)
|
||||
m += '/'
|
||||
else if (!isDir && slash)
|
||||
m = m.slice(0, -1)
|
||||
|
||||
if (m !== p) {
|
||||
var mabs = makeAbs(self, m)
|
||||
self.statCache[mabs] = self.statCache[abs]
|
||||
self.cache[mabs] = self.cache[abs]
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// lotta situps...
|
||||
function makeAbs (self, f) {
|
||||
var abs = f
|
||||
if (f.charAt(0) === '/') {
|
||||
abs = path.join(self.root, f)
|
||||
} else if (isAbsolute(f) || f === '') {
|
||||
abs = f
|
||||
} else if (self.changedCwd) {
|
||||
abs = path.resolve(self.cwd, f)
|
||||
} else {
|
||||
abs = path.resolve(f)
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
abs = abs.replace(/\\/g, '/')
|
||||
|
||||
return abs
|
||||
}
|
||||
|
||||
|
||||
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
||||
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
||||
function isIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
|
||||
function childrenIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
790
node_modules/jest-config/node_modules/glob/glob.js
generated
vendored
Normal file
790
node_modules/jest-config/node_modules/glob/glob.js
generated
vendored
Normal file
@@ -0,0 +1,790 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern, false)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern, inGlobStar)
|
||||
// Get the first [n] items from pattern that are all strings
|
||||
// Join these together. This is PREFIX.
|
||||
// If there is no more remaining, then stat(PREFIX) and
|
||||
// add to matches if it succeeds. END.
|
||||
//
|
||||
// If inGlobStar and PREFIX is symlink and points to dir
|
||||
// set ENTRIES = []
|
||||
// else readdir(PREFIX) as ENTRIES
|
||||
// If fail, END
|
||||
//
|
||||
// with ENTRIES
|
||||
// If pattern[n] is GLOBSTAR
|
||||
// // handle the case where the globstar match is empty
|
||||
// // by pruning it out, and testing the resulting pattern
|
||||
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// // Mark that this entry is a globstar match
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
||||
//
|
||||
// else // not globstar
|
||||
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||
// Test ENTRY against pattern[n]
|
||||
// If fails, continue
|
||||
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||
//
|
||||
// Caveat:
|
||||
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||
// we ever care about is existence and directory-ness, we can just keep
|
||||
// `true` for files, and [children,...] for directories, or `false` for
|
||||
// things that don't exist.
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var rp = require('fs.realpath')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var inherits = require('inherits')
|
||||
var EE = require('events').EventEmitter
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var globSync = require('./sync.js')
|
||||
var common = require('./common.js')
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var inflight = require('inflight')
|
||||
var util = require('util')
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
var once = require('once')
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return globSync(pattern, options)
|
||||
}
|
||||
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
var GlobSync = glob.GlobSync = globSync.GlobSync
|
||||
|
||||
// old api surface
|
||||
glob.glob = glob
|
||||
|
||||
function extend (origin, add) {
|
||||
if (add === null || typeof add !== 'object') {
|
||||
return origin
|
||||
}
|
||||
|
||||
var keys = Object.keys(add)
|
||||
var i = keys.length
|
||||
while (i--) {
|
||||
origin[keys[i]] = add[keys[i]]
|
||||
}
|
||||
return origin
|
||||
}
|
||||
|
||||
glob.hasMagic = function (pattern, options_) {
|
||||
var options = extend({}, options_)
|
||||
options.noprocess = true
|
||||
|
||||
var g = new Glob(pattern, options)
|
||||
var set = g.minimatch.set
|
||||
|
||||
if (!pattern)
|
||||
return false
|
||||
|
||||
if (set.length > 1)
|
||||
return true
|
||||
|
||||
for (var j = 0; j < set[0].length; j++) {
|
||||
if (typeof set[0][j] !== 'string')
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (options && options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return new GlobSync(pattern, options)
|
||||
}
|
||||
|
||||
if (!(this instanceof Glob))
|
||||
return new Glob(pattern, options, cb)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
this._didRealPath = false
|
||||
|
||||
// process each pattern in the minimatch set
|
||||
var n = this.minimatch.set.length
|
||||
|
||||
// The matches are stored as {<filename>: true,...} so that
|
||||
// duplicates are automagically pruned.
|
||||
// Later, we do an Object.keys() on these.
|
||||
// Keep them as a list so we can fill in when nonull is set.
|
||||
this.matches = new Array(n)
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
cb = once(cb)
|
||||
this.on('error', cb)
|
||||
this.on('end', function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
var self = this
|
||||
this._processing = 0
|
||||
|
||||
this._emitQueue = []
|
||||
this._processQueue = []
|
||||
this.paused = false
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
if (n === 0)
|
||||
return done()
|
||||
|
||||
var sync = true
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false, done)
|
||||
}
|
||||
sync = false
|
||||
|
||||
function done () {
|
||||
--self._processing
|
||||
if (self._processing <= 0) {
|
||||
if (sync) {
|
||||
process.nextTick(function () {
|
||||
self._finish()
|
||||
})
|
||||
} else {
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (this.realpath && !this._didRealpath)
|
||||
return this._realpath()
|
||||
|
||||
common.finish(this)
|
||||
this.emit('end', this.found)
|
||||
}
|
||||
|
||||
Glob.prototype._realpath = function () {
|
||||
if (this._didRealpath)
|
||||
return
|
||||
|
||||
this._didRealpath = true
|
||||
|
||||
var n = this.matches.length
|
||||
if (n === 0)
|
||||
return this._finish()
|
||||
|
||||
var self = this
|
||||
for (var i = 0; i < this.matches.length; i++)
|
||||
this._realpathSet(i, next)
|
||||
|
||||
function next () {
|
||||
if (--n === 0)
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._realpathSet = function (index, cb) {
|
||||
var matchset = this.matches[index]
|
||||
if (!matchset)
|
||||
return cb()
|
||||
|
||||
var found = Object.keys(matchset)
|
||||
var self = this
|
||||
var n = found.length
|
||||
|
||||
if (n === 0)
|
||||
return cb()
|
||||
|
||||
var set = this.matches[index] = Object.create(null)
|
||||
found.forEach(function (p, i) {
|
||||
// If there's a problem with the stat, then it means that
|
||||
// one or more of the links in the realpath couldn't be
|
||||
// resolved. just return the abs value in that case.
|
||||
p = self._makeAbs(p)
|
||||
rp.realpath(p, self.realpathCache, function (er, real) {
|
||||
if (!er)
|
||||
set[real] = true
|
||||
else if (er.syscall === 'stat')
|
||||
set[p] = true
|
||||
else
|
||||
self.emit('error', er) // srsly wtf right here
|
||||
|
||||
if (--n === 0) {
|
||||
self.matches[index] = set
|
||||
cb()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
Glob.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit('abort')
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (!this.paused) {
|
||||
this.paused = true
|
||||
this.emit('pause')
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (this.paused) {
|
||||
this.emit('resume')
|
||||
this.paused = false
|
||||
if (this._emitQueue.length) {
|
||||
var eq = this._emitQueue.slice(0)
|
||||
this._emitQueue.length = 0
|
||||
for (var i = 0; i < eq.length; i ++) {
|
||||
var e = eq[i]
|
||||
this._emitMatch(e[0], e[1])
|
||||
}
|
||||
}
|
||||
if (this._processQueue.length) {
|
||||
var pq = this._processQueue.slice(0)
|
||||
this._processQueue.length = 0
|
||||
for (var i = 0; i < pq.length; i ++) {
|
||||
var p = pq[i]
|
||||
this._processing--
|
||||
this._process(p[0], p[1], p[2], p[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
||||
assert(this instanceof Glob)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
this._processing++
|
||||
if (this.paused) {
|
||||
this._processQueue.push([pattern, index, inGlobStar, cb])
|
||||
return
|
||||
}
|
||||
|
||||
//console.error('PROCESS %d', this._processing, pattern)
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === 'string') {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// see if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
this._processSimple(pattern.join('/'), index, cb)
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||
// or 'relative' like '../baz'
|
||||
prefix = pattern.slice(0, n).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) ||
|
||||
isAbsolute(pattern.map(function (p) {
|
||||
return typeof p === 'string' ? p : '[*]'
|
||||
}).join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip _processing
|
||||
if (childrenIgnored(this, read))
|
||||
return cb()
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return cb()
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return cb()
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
this._process([e].concat(remain), index, inGlobStar, cb)
|
||||
}
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._emitMatch = function (index, e) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
if (this.paused) {
|
||||
this._emitQueue.push([index, e])
|
||||
return
|
||||
}
|
||||
|
||||
var abs = isAbsolute(e) ? e : this._makeAbs(e)
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.absolute)
|
||||
e = abs
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
var st = this.statCache[abs]
|
||||
if (st)
|
||||
this.emit('stat', e, st)
|
||||
|
||||
this.emit('match', e)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false, cb)
|
||||
|
||||
var lstatkey = 'lstat\0' + abs
|
||||
var self = this
|
||||
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||
|
||||
if (lstatcb)
|
||||
self.fs.lstat(abs, lstatcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (er && er.code === 'ENOENT')
|
||||
return cb()
|
||||
|
||||
var isSym = lstat && lstat.isSymbolicLink()
|
||||
self.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && lstat && !lstat.isDirectory()) {
|
||||
self.cache[abs] = 'FILE'
|
||||
cb()
|
||||
} else
|
||||
self._readdir(abs, false, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
||||
if (!cb)
|
||||
return
|
||||
|
||||
//console.error('RD %j %j', +inGlobStar, abs)
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs, cb)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return cb()
|
||||
|
||||
if (Array.isArray(c))
|
||||
return cb(null, c)
|
||||
}
|
||||
|
||||
var self = this
|
||||
self.fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
}
|
||||
|
||||
function readdirCb (self, abs, cb) {
|
||||
return function (er, entries) {
|
||||
if (er)
|
||||
self._readdirError(abs, er, cb)
|
||||
else
|
||||
self._readdirEntries(abs, entries, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
return cb(null, entries)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirError = function (f, er, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
var abs = this._makeAbs(f)
|
||||
this.cache[abs] = 'FILE'
|
||||
if (abs === this.cwdAbs) {
|
||||
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||
error.path = this.cwd
|
||||
error.code = er.code
|
||||
this.emit('error', error)
|
||||
this.abort()
|
||||
}
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict) {
|
||||
this.emit('error', er)
|
||||
// If the error is handled, then we abort
|
||||
// if not, we threw out of here
|
||||
this.abort()
|
||||
}
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
|
||||
return cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
//console.error('pgs2', prefix, remain[0], entries)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false, cb)
|
||||
|
||||
var isSym = this.symlinks[abs]
|
||||
var len = entries.length
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return cb()
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true, cb)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true, cb)
|
||||
}
|
||||
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processSimple = function (prefix, index, cb) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var self = this
|
||||
this._stat(prefix, function (er, exists) {
|
||||
self._processSimple2(prefix, index, er, exists, cb)
|
||||
})
|
||||
}
|
||||
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
||||
|
||||
//console.error('ps2', prefix, exists)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return cb()
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return cb()
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return cb(null, c)
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (stat !== undefined) {
|
||||
if (stat === false)
|
||||
return cb(null, stat)
|
||||
else {
|
||||
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
if (needDir && type === 'FILE')
|
||||
return cb()
|
||||
else
|
||||
return cb(null, type, stat)
|
||||
}
|
||||
}
|
||||
|
||||
var self = this
|
||||
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||
if (statcb)
|
||||
self.fs.lstat(abs, statcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
// If it's a symlink, then treat it as the target, unless
|
||||
// the target does not exist, then treat it as a file.
|
||||
return self.fs.stat(abs, function (er, stat) {
|
||||
if (er)
|
||||
self._stat2(f, abs, null, lstat, cb)
|
||||
else
|
||||
self._stat2(f, abs, er, stat, cb)
|
||||
})
|
||||
} else {
|
||||
self._stat2(f, abs, er, lstat, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
return cb()
|
||||
}
|
||||
|
||||
var needDir = f.slice(-1) === '/'
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
||||
return cb(null, false, stat)
|
||||
|
||||
var c = true
|
||||
if (stat)
|
||||
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
return cb(null, c, stat)
|
||||
}
|
||||
55
node_modules/jest-config/node_modules/glob/package.json
generated
vendored
Normal file
55
node_modules/jest-config/node_modules/glob/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"name": "glob",
|
||||
"description": "a little globber",
|
||||
"version": "7.2.3",
|
||||
"publishConfig": {
|
||||
"tag": "v7-legacy"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-glob.git"
|
||||
},
|
||||
"main": "glob.js",
|
||||
"files": [
|
||||
"glob.js",
|
||||
"sync.js",
|
||||
"common.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"memfs": "^3.2.0",
|
||||
"mkdirp": "0",
|
||||
"rimraf": "^2.2.8",
|
||||
"tap": "^15.0.6",
|
||||
"tick": "0.0.6"
|
||||
},
|
||||
"tap": {
|
||||
"before": "test/00-setup.js",
|
||||
"after": "test/zz-cleanup.js",
|
||||
"jobs": 1
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm run benchclean",
|
||||
"profclean": "rm -f v8.log profile.txt",
|
||||
"test": "tap",
|
||||
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js",
|
||||
"bench": "bash benchmark.sh",
|
||||
"prof": "bash prof.sh && cat profile.txt",
|
||||
"benchclean": "node benchclean.js"
|
||||
},
|
||||
"license": "ISC",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
}
|
||||
486
node_modules/jest-config/node_modules/glob/sync.js
generated
vendored
Normal file
486
node_modules/jest-config/node_modules/glob/sync.js
generated
vendored
Normal file
@@ -0,0 +1,486 @@
|
||||
module.exports = globSync
|
||||
globSync.GlobSync = GlobSync
|
||||
|
||||
var rp = require('fs.realpath')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var Glob = require('./glob.js').Glob
|
||||
var util = require('util')
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var common = require('./common.js')
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
function globSync (pattern, options) {
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
return new GlobSync(pattern, options).found
|
||||
}
|
||||
|
||||
function GlobSync (pattern, options) {
|
||||
if (!pattern)
|
||||
throw new Error('must provide pattern')
|
||||
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
if (!(this instanceof GlobSync))
|
||||
return new GlobSync(pattern, options)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
var n = this.minimatch.set.length
|
||||
this.matches = new Array(n)
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false)
|
||||
}
|
||||
this._finish()
|
||||
}
|
||||
|
||||
GlobSync.prototype._finish = function () {
|
||||
assert.ok(this instanceof GlobSync)
|
||||
if (this.realpath) {
|
||||
var self = this
|
||||
this.matches.forEach(function (matchset, index) {
|
||||
var set = self.matches[index] = Object.create(null)
|
||||
for (var p in matchset) {
|
||||
try {
|
||||
p = self._makeAbs(p)
|
||||
var real = rp.realpathSync(p, self.realpathCache)
|
||||
set[real] = true
|
||||
} catch (er) {
|
||||
if (er.syscall === 'stat')
|
||||
set[self._makeAbs(p)] = true
|
||||
else
|
||||
throw er
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
common.finish(this)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
||||
assert.ok(this instanceof GlobSync)
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === 'string') {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// See if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
this._processSimple(pattern.join('/'), index)
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||
// or 'relative' like '../baz'
|
||||
prefix = pattern.slice(0, n).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) ||
|
||||
isAbsolute(pattern.map(function (p) {
|
||||
return typeof p === 'string' ? p : '[*]'
|
||||
}).join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip processing
|
||||
if (childrenIgnored(this, read))
|
||||
return
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix.slice(-1) !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix)
|
||||
newPattern = [prefix, e]
|
||||
else
|
||||
newPattern = [e]
|
||||
this._process(newPattern.concat(remain), index, inGlobStar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._emitMatch = function (index, e) {
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
var abs = this._makeAbs(e)
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.absolute) {
|
||||
e = abs
|
||||
}
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
if (this.stat)
|
||||
this._stat(e)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false)
|
||||
|
||||
var entries
|
||||
var lstat
|
||||
var stat
|
||||
try {
|
||||
lstat = this.fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
// lstat failed, doesn't exist
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
var isSym = lstat && lstat.isSymbolicLink()
|
||||
this.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && lstat && !lstat.isDirectory())
|
||||
this.cache[abs] = 'FILE'
|
||||
else
|
||||
entries = this._readdir(abs, false)
|
||||
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
||||
var entries
|
||||
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return null
|
||||
|
||||
if (Array.isArray(c))
|
||||
return c
|
||||
}
|
||||
|
||||
try {
|
||||
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
||||
} catch (er) {
|
||||
this._readdirError(abs, er)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
|
||||
// mark and cache dir-ness
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirError = function (f, er) {
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
var abs = this._makeAbs(f)
|
||||
this.cache[abs] = 'FILE'
|
||||
if (abs === this.cwdAbs) {
|
||||
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||
error.path = this.cwd
|
||||
error.code = er.code
|
||||
throw error
|
||||
}
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict)
|
||||
throw er
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false)
|
||||
|
||||
var len = entries.length
|
||||
var isSym = this.symlinks[abs]
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true)
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processSimple = function (prefix, index) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var exists = this._stat(prefix)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
GlobSync.prototype._stat = function (f) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return false
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return false
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (!stat) {
|
||||
var lstat
|
||||
try {
|
||||
lstat = this.fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
try {
|
||||
stat = this.fs.statSync(abs)
|
||||
} catch (er) {
|
||||
stat = lstat
|
||||
}
|
||||
} else {
|
||||
stat = lstat
|
||||
}
|
||||
}
|
||||
|
||||
this.statCache[abs] = stat
|
||||
|
||||
var c = true
|
||||
if (stat)
|
||||
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return false
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
GlobSync.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
GlobSync.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
71
node_modules/jest-config/package.json
generated
vendored
Normal file
71
node_modules/jest-config/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "jest-config",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-config"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "*",
|
||||
"ts-node": ">=9.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"ts-node": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@jest/test-sequencer": "^29.7.0",
|
||||
"@jest/types": "^29.6.3",
|
||||
"babel-jest": "^29.7.0",
|
||||
"chalk": "^4.0.0",
|
||||
"ci-info": "^3.2.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"glob": "^7.1.3",
|
||||
"graceful-fs": "^4.2.9",
|
||||
"jest-circus": "^29.7.0",
|
||||
"jest-environment-node": "^29.7.0",
|
||||
"jest-get-type": "^29.6.3",
|
||||
"jest-regex-util": "^29.6.3",
|
||||
"jest-resolve": "^29.7.0",
|
||||
"jest-runner": "^29.7.0",
|
||||
"jest-util": "^29.7.0",
|
||||
"jest-validate": "^29.7.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"parse-json": "^5.2.0",
|
||||
"pretty-format": "^29.7.0",
|
||||
"slash": "^3.0.0",
|
||||
"strip-json-comments": "^3.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/graceful-fs": "^4.1.3",
|
||||
"@types/micromatch": "^4.0.1",
|
||||
"@types/parse-json": "^4.0.0",
|
||||
"semver": "^7.5.3",
|
||||
"ts-node": "^10.5.0",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
Reference in New Issue
Block a user