MCPcopy
hub / github.com/jestjs/jest / buildTestPathPatterns

Function buildTestPathPatterns

packages/jest-config/src/normalize.ts:448–475  ·  view source on GitHub ↗
(argv: Config.Argv)

Source from the content-addressed store, hash-verified

446};
447
448const buildTestPathPatterns = (argv: Config.Argv): TestPathPatterns => {
449 const patterns = [];
450
451 if (argv._) {
452 patterns.push(...argv._.map(x => x.toString()));
453 }
454 if (argv.testPathPatterns) {
455 patterns.push(...argv.testPathPatterns);
456 }
457
458 const testPathPatterns = new TestPathPatterns(patterns);
459
460 if (!testPathPatterns.isValid()) {
461 clearLine(process.stdout);
462
463 // eslint-disable-next-line no-console
464 console.log(
465 chalk.red(
466 ` Invalid testPattern ${testPathPatterns.toPretty()} supplied. ` +
467 'Running all tests instead.',
468 ),
469 );
470
471 return new TestPathPatterns([]);
472 }
473
474 return testPathPatterns;
475};
476
477function printConfig(opts: Array<string>) {
478 const string = opts.map(ext => `'${ext}'`).join(', ');

Callers 1

normalizeFunction · 0.85

Calls 5

isValidMethod · 0.95
toPrettyMethod · 0.95
clearLineFunction · 0.90
toStringMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected