Home / Function/ runFixtures() — react Function Reference

runFixtures() — react Function Reference

Architecture documentation for the runFixtures() function in runner.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8b079862_93aa_0084_8b1a_0473b6ef4307["runFixtures()"]
  1fd49604_fb16_2568_4971_9eca12fd6a73["runner.ts"]
  8b079862_93aa_0084_8b1a_0473b6ef4307 -->|defined in| 1fd49604_fb16_2568_4971_9eca12fd6a73
  4b902db8_39ff_6c09_0a25_3a6bd51d0bf7["runTestCommand()"]
  4b902db8_39ff_6c09_0a25_3a6bd51d0bf7 -->|calls| 8b079862_93aa_0084_8b1a_0473b6ef4307
  6f987440_694d_ff09_5b9e_6bb4093380cc["onChange()"]
  6f987440_694d_ff09_5b9e_6bb4093380cc -->|calls| 8b079862_93aa_0084_8b1a_0473b6ef4307
  35f5a65c_e6e8_8fa8_f9c0_158316bd8913["getFixtures()"]
  8b079862_93aa_0084_8b1a_0473b6ef4307 -->|calls| 35f5a65c_e6e8_8fa8_f9c0_158316bd8913
  5e39198b_b086_5261_de7a_7fc49349ecb6["transformFixture()"]
  8b079862_93aa_0084_8b1a_0473b6ef4307 -->|calls| 5e39198b_b086_5261_de7a_7fc49349ecb6
  style 8b079862_93aa_0084_8b1a_0473b6ef4307 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/snap/src/runner.ts lines 430–472

async function runFixtures(
  worker: Worker & typeof runnerWorker,
  filter: TestFilter | null,
  compilerVersion: number,
  debug: boolean,
  requireSingleFixture: boolean,
  sync: boolean,
): Promise<TestResults> {
  // We could in theory be fancy about tracking the contents of the fixtures
  // directory via our file subscription, but it's simpler to just re-read
  // the directory each time.
  const fixtures = await getFixtures(filter);
  const isOnlyFixture = filter !== null && fixtures.size === 1;
  const shouldLog = debug && (!requireSingleFixture || isOnlyFixture);

  let entries: Array<[string, TestResult]>;
  if (!sync) {
    // Note: promise.all to ensure parallelism when enabled
    const work: Array<Promise<[string, TestResult]>> = [];
    for (const [fixtureName, fixture] of fixtures) {
      work.push(
        worker
          .transformFixture(fixture, compilerVersion, shouldLog, true)
          .then(result => [fixtureName, result]),
      );
    }

    entries = await Promise.all(work);
  } else {
    entries = [];
    for (const [fixtureName, fixture] of fixtures) {
      let output = await runnerWorker.transformFixture(
        fixture,
        compilerVersion,
        shouldLog,
        true,
      );
      entries.push([fixtureName, output]);
    }
  }

  return new Map(entries);
}

Domain

Subdomains

Frequently Asked Questions

What does runFixtures() do?
runFixtures() is a function in the react codebase, defined in compiler/packages/snap/src/runner.ts.
Where is runFixtures() defined?
runFixtures() is defined in compiler/packages/snap/src/runner.ts at line 430.
What does runFixtures() call?
runFixtures() calls 2 function(s): getFixtures, transformFixture.
What calls runFixtures()?
runFixtures() is called by 2 function(s): onChange, runTestCommand.

Analyze Your Own Codebase

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

Try Supermodel Free