mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
Change endpoint from persons to people
This commit is contained in:
129
backend/apis/nodejs/node_modules/jest-config/build/Defaults.js
generated
vendored
Normal file
129
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/Deprecated.js
generated
vendored
Normal file
85
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/Descriptions.js
generated
vendored
Normal file
104
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/ReporterValidationErrors.js
generated
vendored
Normal file
122
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/ValidConfig.js
generated
vendored
Normal file
342
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/color.js
generated
vendored
Normal file
31
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/constants.js
generated
vendored
Normal file
96
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/getCacheDirectory.js
generated
vendored
Normal file
91
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/getMaxWorkers.js
generated
vendored
Normal file
56
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/index.d.ts
generated
vendored
Normal file
147
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/index.js
generated
vendored
Normal file
494
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
1180
backend/apis/nodejs/node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
backend/apis/nodejs/node_modules/jest-config/build/parseShardPair.js
generated
vendored
Normal file
41
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/readConfigFileAndSetRootDir.js
generated
vendored
Normal file
195
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/resolveConfigPath.js
generated
vendored
Normal file
217
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/setFromArgv.js
generated
vendored
Normal file
58
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/stringToBytes.js
generated
vendored
Normal file
79
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/utils.js
generated
vendored
Normal file
172
backend/apis/nodejs/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
backend/apis/nodejs/node_modules/jest-config/build/validatePattern.js
generated
vendored
Normal file
24
backend/apis/nodejs/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;
|
||||
}
|
Reference in New Issue
Block a user