Home / Function/ main() — react Function Reference

main() — react Function Reference

Architecture documentation for the main() function in jest-cli.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  aed9173d_673b_258c_6512_6c3881464cc9["main()"]
  275b3ae7_7007_e04d_7b4e_3740a2f0eb52["jest-cli.js"]
  aed9173d_673b_258c_6512_6c3881464cc9 -->|defined in| 275b3ae7_7007_e04d_7b4e_3740a2f0eb52
  cdec5053_8e42_ae51_fe4d_1efd82394de5["validateOptions()"]
  aed9173d_673b_258c_6512_6c3881464cc9 -->|calls| cdec5053_8e42_ae51_fe4d_1efd82394de5
  9295d571_bfa6_f0de_389c_4c52aef9a5a4["getCommandArgs()"]
  aed9173d_673b_258c_6512_6c3881464cc9 -->|calls| 9295d571_bfa6_f0de_389c_4c52aef9a5a4
  52eba91c_e2ab_7660_f56c_9eacedf7400e["getEnvars()"]
  aed9173d_673b_258c_6512_6c3881464cc9 -->|calls| 52eba91c_e2ab_7660_f56c_9eacedf7400e
  style aed9173d_673b_258c_6512_6c3881464cc9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/jest/jest-cli.js lines 378–418

function main() {
  validateOptions();

  const args = getCommandArgs();
  const envars = getEnvars();
  const env = Object.entries(envars).map(([k, v]) => `${k}=${v}`);

  if (argv.ci !== true) {
    // Print the full command we're actually running.
    const command = `$ ${env.join(' ')} node ${args.join(' ')}`;
    console.log(chalk.dim(command));

    // Print the release channel and project we're running for quick confirmation.
    console.log(
      chalk.blue(
        `\nRunning tests for ${argv.project} (${argv.releaseChannel})...`
      )
    );
  }

  // Print a message that the debugger is starting just
  // for some extra feedback when running the debugger.
  if (argv.debug) {
    console.log(chalk.green('\nStarting debugger...'));
    console.log(chalk.green('Open chrome://inspect and press "inspect"\n'));
  }

  // Run Jest.
  const jest = spawn('node', args, {
    stdio: 'inherit',
    env: {...envars, ...process.env},
  });

  // Ensure we close our process when we get a failure case.
  jest.on('close', code => {
    // Forward the exit code from the Jest process.
    if (code === 1) {
      process.exit(1);
    }
  });
}

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in scripts/jest/jest-cli.js.
Where is main() defined?
main() is defined in scripts/jest/jest-cli.js at line 378.
What does main() call?
main() calls 3 function(s): getCommandArgs, getEnvars, validateOptions.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free