diff --git a/compiler/forget/packages/snap/src/runner.ts b/compiler/forget/packages/snap/src/runner.ts index 7e5ce0ac4f..86b5ecd3ee 100644 --- a/compiler/forget/packages/snap/src/runner.ts +++ b/compiler/forget/packages/snap/src/runner.ts @@ -99,28 +99,32 @@ async function run(compilerVersion: number): Promise { ) ).sort(); - // Note: promise.all to ensure parallelism when enabled - const entries: Array<[string, TestResult]> = await Promise.all( - fixtures.map(async (fixture) => { - let output: TestResult; - if (PARALLEL) { - output = await worker.compile( + let entries: Array<[string, TestResult]>; + if (PARALLEL) { + // Note: promise.all to ensure parallelism when enabled + entries = await Promise.all( + fixtures.map(async (fixture) => { + let output = await worker.compile( COMPILER_PATH, FIXTURES_PATH, fixture, compilerVersion ); - } else { - output = await compiler.compile( - COMPILER_PATH, - FIXTURES_PATH, - fixture, - compilerVersion - ); - } - return [fixture, output]; - }) - ); + return [fixture, output]; + }) + ); + } else { + entries = []; + for (const fixture of fixtures) { + let output = await compiler.compile( + COMPILER_PATH, + FIXTURES_PATH, + fixture, + compilerVersion + ); + entries.push([fixture, output]); + } + } return new Map(entries); }