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

Function run

packages/jest-cli/src/run.ts:20–42  ·  view source on GitHub ↗
(
  maybeArgv?: Array<string>,
  project?: string,
)

Source from the content-addressed store, hash-verified

18import * as args from './args';
19
20export async function run(
21 maybeArgv?: Array<string>,
22 project?: string,
23): Promise<void> {
24 try {
25 const argv = await buildArgv(maybeArgv);
26 const projects = getProjectListFromCLIArgs(argv, project);
27
28 const {results, globalConfig} = await runCLI(argv, projects);
29 readResultsAndExit(results, globalConfig);
30 } catch (error: any) {
31 clearLine(process.stderr);
32 clearLine(process.stdout);
33 if (error?.stack) {
34 console.error(chalk.red(error.stack));
35 } else {
36 console.error(chalk.red(error));
37 }
38
39 exit(1);
40 throw error;
41 }
42}
43
44export async function buildArgv(
45 maybeArgv?: Array<string>,

Callers 1

esm.jsFile · 0.90

Calls 7

runCLIFunction · 0.90
clearLineFunction · 0.90
buildArgvFunction · 0.85
readResultsAndExitFunction · 0.85
exitFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected