test(vitest): run pool workers with the WASM runtime flags (#1779) (#2046)

A vitest pool worker is the one launch path that never received
`--liftoff-only`, so the suite compiled tree-sitter grammars on the
turboshaft tier. Once ~640 extraction tests have warmed a grammar function
up, its background tier-up job (Turboshaft LoopUnrollingPhase, symbolized
from the native stack) exhausts a compiler Zone and aborts the worker:
`Fatal process out of memory: Zone`, which vitest reports only as "Worker
exited unexpectedly" with the file's remaining tests unrun.

Pass WASM_RUNTIME_FLAGS through poolOptions.forks.execArgv, so the test
process matches the bundled launcher, the CLI re-exec and refresh-launcher.
V8 flags are process-global, so parse worker threads are covered too.

Linux x64, Node 24.15, `__tests__/extraction.test.ts` (655 tests):
without the flag 3 of 4 runs died at the same test (639 passed);
with it 2 of 2 passed, in 19–24s instead of 34–41s. Neither
`--no-wasm-loop-unrolling` nor `--no-wasm-dynamic-tiering` prevents it.


(cherry picked from commit 565ec815e6)

Co-authored-by: danusha2345 <danusha2345@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-09-27 15:01:15 +00:00
committed by GitHub
parent 594bad7ec4
commit 7af240923d
+16
View File
@@ -1,4 +1,5 @@
import { defineConfig } from 'vitest/config';
import { WASM_RUNTIME_FLAGS } from './src/extraction/wasm-runtime-flags';
/**
* The SHARED base. `vitest.workspace.mts` extends it twice — once for the
@@ -36,6 +37,21 @@ export default defineConfig({
*/
CODEGRAPH_TELEMETRY: '0',
},
/**
* The same V8 flags every real launch path passes (the bundled launcher,
* the CLI's self re-exec, refresh-launcher): keep tree-sitter grammar
* compilation on the Liftoff baseline tier. Without them a pool worker
* runs the grammars on the turboshaft optimizing tier, and once enough
* parses have warmed a grammar function up, its background tier-up job
* exhausts a compiler Zone and aborts the worker — `Fatal process out of
* memory: Zone`, surfaced by vitest only as "Worker exited unexpectedly"
* with the rest of the file's tests silently unrun (#1779; the product-side
* story is in wasm-runtime-flags.ts, #293/#298). On Node 24 with a
* 660-test extraction suite this reproduced on every run at the same test.
* V8 flags are process-global, so the parse worker threads a test spawns
* are covered too.
*/
poolOptions: { forks: { execArgv: [...WASM_RUNTIME_FLAGS] } },
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],