| 446 | }; |
| 447 | |
| 448 | const 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 | |
| 477 | function printConfig(opts: Array<string>) { |
| 478 | const string = opts.map(ext => `'${ext}'`).join(', '); |