1
0
mirror of https://github.com/actions/labeler synced 2026-05-09 20:51:03 +02:00
This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

23
node_modules/jest-config/LICENSE generated vendored
View File

@@ -1,23 +0,0 @@
MIT License
For Jest software
Copyright (c) 2014-present, Facebook, Inc.
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.

View File

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

View File

@@ -60,6 +60,7 @@ const defaultOptions = {
throwOnModuleCollision: false
},
maxConcurrency: 5,
maxWorkers: '50%',
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
moduleNameMapper: {},

View File

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

View File

@@ -41,6 +41,8 @@ const descriptions = {
'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',

View File

@@ -13,7 +13,7 @@ import { Config } from '@jest/types';
* merged with jest-validate. Till then, we can make use of it. It works
* and that's what counts most at this time.
*/
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): import("../../jest-validate/build/utils").ValidationError;
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, any>, expectedType: string, valueName: string): import("../../jest-validate/build/utils").ValidationError;
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): import("jest-validate/build/utils").ValidationError;
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, any>, expectedType: string, valueName: string): import("jest-validate/build/utils").ValidationError;
export declare function validateReporters(reporterConfig: Array<Config.ReporterConfig | string>): boolean;
//# sourceMappingURL=ReporterValidationErrors.d.ts.map

View File

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

View File

@@ -38,7 +38,6 @@ const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
);
const initialOptions = {
automock: false,
// @ts-ignore TODO: type this properly
bail: (0, _jestValidate().multipleValidOptions)(false, 0),
browser: false,
cache: true,
@@ -63,7 +62,6 @@ const initialOptions = {
}
},
dependencyExtractor: '<rootDir>/dependencyExtractor.js',
// @ts-ignore TODO: type this properly
displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
color: 'blue',
name: 'test-config'
@@ -91,6 +89,7 @@ const initialOptions = {
lastCommit: false,
logHeapUsage: true,
maxConcurrency: 5,
maxWorkers: '50%',
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
moduleLoader: '<rootDir>',
@@ -148,6 +147,7 @@ const initialOptions = {
testResultsProcessor: 'processor-node-module',
testRunner: 'jasmine2',
testSequencer: '@jest/test-sequencer',
testTimeout: 5000,
testURL: 'http://localhost',
timers: 'real',
transform: {

View File

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

View File

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

View File

@@ -25,30 +25,34 @@ function _interopRequireDefault(obj) {
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getMaxWorkers(argv) {
function getMaxWorkers(argv, defaultOptions) {
if (argv.runInBand) {
return 1;
} else if (argv.maxWorkers) {
// TODO: How to type this properly? Should probably use `coerce` from `yargs`
const maxWorkers = argv.maxWorkers;
const parsed = parseInt(maxWorkers, 10);
if (
typeof maxWorkers === 'string' &&
maxWorkers.trim().endsWith('%') &&
parsed > 0 &&
parsed <= 100
) {
const cpus = _os().default.cpus().length;
const workers = Math.floor((parsed / 100) * cpus);
return workers >= 1 ? workers : 1;
}
return parsed > 0 ? parsed : 1;
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 cpus = _os().default.cpus() ? _os().default.cpus().length : 1;
return Math.max(argv.watch ? Math.floor(cpus / 2) : cpus - 1, 1);
}
}
const parseWorkers = maxWorkers => {
const parsed = parseInt(maxWorkers.toString(), 10);
if (
typeof maxWorkers === 'string' &&
maxWorkers.trim().endsWith('%') &&
parsed > 0 &&
parsed <= 100
) {
const cpus = _os().default.cpus().length;
const workers = Math.floor((parsed / 100) * cpus);
return workers >= 1 ? workers : 1;
}
return parsed > 0 ? parsed : 1;
};

View File

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

View File

@@ -230,6 +230,7 @@ const groupOptions = options => ({
testPathPattern: options.testPathPattern,
testResultsProcessor: options.testResultsProcessor,
testSequencer: options.testSequencer,
testTimeout: options.testTimeout,
updateSnapshot: options.updateSnapshot,
useStderr: options.useStderr,
verbose: options.verbose,

View File

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

View File

@@ -178,15 +178,26 @@ const createConfigError = message =>
ERROR,
message,
_utils.DOCUMENTATION_NOTE
);
); // TS 3.5 forces us to split these into 2
const mergeOptionWithPreset = (options, preset, optionName) => {
if (options[optionName] && preset[optionName]) {
options[optionName] = _objectSpread(
const mergeModuleNameMapperWithPreset = (options, preset) => {
if (options['moduleNameMapper'] && preset['moduleNameMapper']) {
options['moduleNameMapper'] = _objectSpread(
{},
options[optionName],
preset[optionName],
options[optionName]
options['moduleNameMapper'],
preset['moduleNameMapper'],
options['moduleNameMapper']
);
}
};
const mergeTransformWithPreset = (options, preset) => {
if (options['transform'] && preset['transform']) {
options['transform'] = _objectSpread(
{},
options['transform'],
preset['transform'],
options['transform']
);
}
};
@@ -253,8 +264,8 @@ const setupPreset = (options, optionsPreset) => {
);
}
mergeOptionWithPreset(options, preset, 'moduleNameMapper');
mergeOptionWithPreset(options, preset, 'transform');
mergeModuleNameMapperWithPreset(options, preset);
mergeTransformWithPreset(options, preset);
return _objectSpread({}, preset, options);
};
@@ -271,28 +282,27 @@ const setupBabelJest = options => {
const regex = new RegExp(pattern);
return regex.test('a.ts') || regex.test('a.tsx');
});
[customJSPattern, customTSPattern].forEach(pattern => {
if (pattern) {
const customTransformer = transform[pattern];
if (customJSPattern) {
const customJSTransformer = transform[customJSPattern];
if (customJSTransformer === 'babel-jest') {
babelJest = require.resolve('babel-jest');
transform[customJSPattern] = babelJest;
} else if (customJSTransformer.includes('babel-jest')) {
babelJest = customJSTransformer;
if (Array.isArray(customTransformer)) {
if (customTransformer[0] === 'babel-jest') {
babelJest = require.resolve('babel-jest');
customTransformer[0] = babelJest;
} else if (customTransformer[0].includes('babel-jest')) {
babelJest = customTransformer[0];
}
} else {
if (customTransformer === 'babel-jest') {
babelJest = require.resolve('babel-jest');
transform[pattern] = babelJest;
} else if (customTransformer.includes('babel-jest')) {
babelJest = customTransformer;
}
}
}
}
if (customTSPattern) {
const customTSTransformer = transform[customTSPattern];
if (customTSTransformer === 'babel-jest') {
babelJest = require.resolve('babel-jest');
transform[customTSPattern] = babelJest;
} else if (customTSTransformer.includes('babel-jest')) {
babelJest = customTSTransformer;
}
}
});
} else {
babelJest = require.resolve('babel-jest');
options.transform = {
@@ -738,14 +748,20 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
const transform = oldOptions[key];
value =
transform &&
Object.keys(transform).map(regex => [
regex,
(0, _utils.resolve)(newOptions.resolver, {
filePath: transform[regex],
key,
rootDir: options.rootDir
})
]);
Object.keys(transform).map(regex => {
const transformElement = transform[regex];
return [
regex,
(0, _utils.resolve)(newOptions.resolver, {
filePath: Array.isArray(transformElement)
? transformElement[0]
: transformElement,
key,
rootDir: options.rootDir
}),
...(Array.isArray(transformElement) ? [transformElement[1]] : [])
];
});
break;
case 'coveragePathIgnorePatterns':
@@ -920,6 +936,19 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
break;
}
case 'testTimeout': {
if (oldOptions[key] < 0) {
throw createConfigError(
` Option "${_chalk().default.bold(
'testTimeout'
)}" must be a natural number.`
);
}
value = oldOptions[key];
break;
}
case 'automock':
case 'browser':
case 'cache':
@@ -1041,7 +1070,7 @@ function normalize(options, argv, configPath, projectIndex = Infinity) {
? 'all'
: 'new';
newOptions.maxConcurrency = parseInt(newOptions.maxConcurrency, 10);
newOptions.maxWorkers = (0, _getMaxWorkers.default)(argv);
newOptions.maxWorkers = (0, _getMaxWorkers.default)(argv, options);
if (newOptions.testRegex.length && options.testMatch) {
throw createConfigError(

View File

@@ -115,7 +115,5 @@ const makeResolutionErrorMessage = (initialPath, cwd) =>
`cwd: "${cwd}"\n` +
'Config paths must be specified by either a direct path to a config\n' +
'file, or a path to a directory. If directory is given, Jest will try to\n' +
`traverse directory tree up, until it finds either "${
_constants.JEST_CONFIG
}" or\n` +
`traverse directory tree up, until it finds either "${_constants.JEST_CONFIG}" or\n` +
`"${_constants.PACKAGE_JSON}".`;

View File

@@ -13,10 +13,13 @@ declare type ResolveOptions = {
};
export declare const BULLET: string;
export declare const DOCUMENTATION_NOTE: string;
export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string | null;
export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string;
export declare const escapeGlobCharacters: (path: string) => string;
export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string;
export declare const _replaceRootDirTags: (rootDir: string, config: any) => any;
declare type OrArray<T> = T | Array<T>;
declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
declare type ReplaceRootDirConfigValues = OrArray<ReplaceRootDirConfigObj> | OrArray<RegExp> | OrArray<Config.Path>;
export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: string, config: T) => T;
export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
filePath: string;
humanOptionName: string;

View File

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

View File

@@ -86,7 +86,7 @@ const resolve = (resolver, {key, filePath, rootDir, optional}) => {
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;
};
@@ -106,31 +106,32 @@ const replaceRootDirInPath = (rootDir, filePath) => {
rootDir,
_path().default.normalize('./' + filePath.substr('<rootDir>'.length))
);
}; // TODO: Type as returning same type as input
};
exports.replaceRootDirInPath = replaceRootDirInPath;
const _replaceRootDirInObject = (rootDir, config) => {
if (config !== null) {
const newConfig = {};
const newConfig = {};
for (const configKey in config) {
newConfig[configKey] =
configKey === 'rootDir'
? config[configKey]
: _replaceRootDirTags(rootDir, config[configKey]);
}
return newConfig;
for (const configKey in config) {
newConfig[configKey] =
configKey === 'rootDir'
? config[configKey]
: _replaceRootDirTags(rootDir, config[configKey]);
}
return config;
}; // TODO: Type as returning same type as input
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));
}

View File

@@ -1,26 +1,19 @@
{
"_args": [
[
"jest-config@24.8.0",
"/Users/pjquirk/Source/GitHub/actions/labeler"
]
],
"_development": true,
"_from": "jest-config@24.8.0",
"_id": "jest-config@24.8.0",
"_from": "jest-config@^24.9.0",
"_id": "jest-config@24.9.0",
"_inBundle": false,
"_integrity": "sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw==",
"_integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==",
"_location": "/jest-config",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "jest-config@24.8.0",
"raw": "jest-config@^24.9.0",
"name": "jest-config",
"escapedName": "jest-config",
"rawSpec": "24.8.0",
"rawSpec": "^24.9.0",
"saveSpec": null,
"fetchSpec": "24.8.0"
"fetchSpec": "^24.9.0"
},
"_requiredBy": [
"/@jest/core",
@@ -28,31 +21,34 @@
"/jest-runtime",
"/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.8.0.tgz",
"_spec": "24.8.0",
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
"_resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz",
"_shasum": "fb1bbc60c73a46af03590719efa4825e6e4dd1b5",
"_spec": "jest-config@^24.9.0",
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/jest/node_modules/jest-cli",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^24.8.0",
"@jest/types": "^24.8.0",
"babel-jest": "^24.8.0",
"@jest/test-sequencer": "^24.9.0",
"@jest/types": "^24.9.0",
"babel-jest": "^24.9.0",
"chalk": "^2.0.1",
"glob": "^7.1.1",
"jest-environment-jsdom": "^24.8.0",
"jest-environment-node": "^24.8.0",
"jest-get-type": "^24.8.0",
"jest-jasmine2": "^24.8.0",
"jest-environment-jsdom": "^24.9.0",
"jest-environment-node": "^24.9.0",
"jest-get-type": "^24.9.0",
"jest-jasmine2": "^24.9.0",
"jest-regex-util": "^24.3.0",
"jest-resolve": "^24.8.0",
"jest-util": "^24.8.0",
"jest-validate": "^24.8.0",
"jest-resolve": "^24.9.0",
"jest-util": "^24.9.0",
"jest-validate": "^24.9.0",
"micromatch": "^3.1.10",
"pretty-format": "^24.8.0",
"pretty-format": "^24.9.0",
"realpath-native": "^1.1.0"
},
"deprecated": false,
"devDependencies": {
"@types/babel__core": "^7.0.4",
"@types/glob": "^7.1.1",
@@ -61,7 +57,7 @@
"engines": {
"node": ">= 6"
},
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4",
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
@@ -75,5 +71,5 @@
"directory": "packages/jest-config"
},
"types": "build/index.d.ts",
"version": "24.8.0"
"version": "24.9.0"
}

View File

@@ -1,20 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
},
// TODO: This is missing `jest-jasmine2`, but that is just
// `require.resolve`d, so no real use for its types
"references": [
{"path": "../jest-environment-jsdom"},
{"path": "../jest-environment-node"},
{"path": "../jest-get-type"},
{"path": "../jest-regex-util"},
{"path": "../jest-resolve"},
{"path": "../jest-types"},
{"path": "../jest-util"},
{"path": "../jest-validate"},
{"path": "../pretty-format"}
]
}

File diff suppressed because it is too large Load Diff