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

Function usage

packages/jest-core/src/watch.ts:536–584  ·  view source on GitHub ↗
(
  globalConfig: Config.GlobalConfig,
  watchPlugins: Array<WatchPlugin>,
  delimiter = '\n',
)

Source from the content-addressed store, hash-verified

534};
535
536const usage = (
537 globalConfig: Config.GlobalConfig,
538 watchPlugins: Array<WatchPlugin>,
539 delimiter = '\n',
540) => {
541 const testPathPatterns = globalConfig.testPathPatterns;
542 const messages = [
543 activeFilters(globalConfig),
544
545 testPathPatterns.isSet() || globalConfig.testNamePattern
546 ? `${chalk.dim(' \u203A Press ')}c${chalk.dim(' to clear filters.')}`
547 : null,
548 `\n${chalk.bold('Watch Usage')}`,
549
550 globalConfig.watch
551 ? `${chalk.dim(' \u203A Press ')}a${chalk.dim(' to run all tests.')}`
552 : null,
553
554 globalConfig.onlyFailures
555 ? `${chalk.dim(' \u203A Press ')}f${chalk.dim(
556 ' to quit "only failed tests" mode.',
557 )}`
558 : `${chalk.dim(' \u203A Press ')}f${chalk.dim(
559 ' to run only failed tests.',
560 )}`,
561
562 (globalConfig.watchAll ||
563 testPathPatterns.isSet() ||
564 globalConfig.testNamePattern) &&
565 !globalConfig.noSCM
566 ? `${chalk.dim(' \u203A Press ')}o${chalk.dim(
567 ' to only run tests related to changed files.',
568 )}`
569 : null,
570
571 ...getSortedUsageRows(watchPlugins, globalConfig).map(
572 plugin =>
573 `${chalk.dim(' \u203A Press')} ${plugin.key} ${chalk.dim(
574 `to ${plugin.prompt}.`,
575 )}`,
576 ),
577
578 `${chalk.dim(' \u203A Press ')}Enter${chalk.dim(
579 ' to trigger a test run.',
580 )}`,
581 ];
582
583 return `${messages.filter(message => !!message).join(delimiter)}\n`;
584};
585
586const showToggleUsagePrompt = () =>
587 '\n' +

Callers 3

startRunFunction · 0.70
onKeypressFunction · 0.70
onCancelPatternPromptFunction · 0.70

Calls 3

getSortedUsageRowsFunction · 0.90
activeFiltersFunction · 0.85
isSetMethod · 0.65

Tested by

no test coverage detected