MCPcopy
hub / github.com/react/react / getFixtures

Function getFixtures

compiler/packages/snap/src/fixture-utils.ts:177–208  ·  view source on GitHub ↗
(
  filter: TestFilter | null,
)

Source from the content-addressed store, hash-verified

175}
176
177export async function getFixtures(
178 filter: TestFilter | null,
179): Promise<Map<string, TestFixture>> {
180 const inputs = await readInputFixtures(FIXTURES_PATH, filter);
181 const outputs = await readOutputFixtures(FIXTURES_PATH, filter);
182
183 const fixtures: Map<string, TestFixture> = new Map();
184 for (const [partialPath, {value, filepath}] of inputs) {
185 const output = outputs.get(partialPath) ?? null;
186 fixtures.set(partialPath, {
187 fixturePath: partialPath,
188 input: value,
189 inputPath: filepath,
190 snapshot: output,
191 snapshotPath: path.join(FIXTURES_PATH, partialPath) + SNAPSHOT_EXTENSION,
192 });
193 }
194
195 for (const [partialPath, output] of outputs) {
196 if (!fixtures.has(partialPath)) {
197 fixtures.set(partialPath, {
198 fixturePath: partialPath,
199 input: null,
200 inputPath: 'none',
201 snapshot: output,
202 snapshotPath:
203 path.join(FIXTURES_PATH, partialPath) + SNAPSHOT_EXTENSION,
204 });
205 }
206 }
207 return fixtures;
208}

Callers 1

runFixturesFunction · 0.90

Calls 6

readInputFixturesFunction · 0.85
readOutputFixturesFunction · 0.85
setMethod · 0.80
joinMethod · 0.80
getMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected