`vitest.setup.ts` sent `HeapProfiler.collectGarbage` over CDP after
every browser test file to work around Chromium leaking shared memory
on `304 Not Modified` module responses, which filled the CI runner's
disk. The collection is stop-the-world and the browser project runs
files concurrently, so under full-suite CPU pressure one file's GC
blocks the renderer while another file is mid-test. Measured over a
full Chromium run at 6x CPU throttling, six collections took between
1.0 s and 1.8 s, longer than the 1 s `vi.waitFor` default. That is the
recurring `Timed out in waitFor!` in `range-decorations.test.tsx`: the
decoration is already in the DOM, but the locator round trip only
returns after the deadline.
Vitest 5.0.5 ships the built-in trigger the hook was waiting for
(vitest-dev/vitest#10912). It runs between files, outside test
execution, and only collects when free space in the temp directory
drops below 4 GiB, so the disk protection stays and the per-file
pause goes away.
The browser project's setup file sent
HeapProfiler.collectGarbageover CDP after every test file, to work around Chromium leaking shared memory on304 Not Modifiedmodule responses (vitest-dev/vitest#9437). The collection is stop-the-world, and browser test files run concurrently, so one file's collection blocks the renderer while another file is mid-test. Under full-suite CPU pressure that pause crosses a second.This shows up as
Timed out in waitFor!at the first range-decoration assertion inrange-decorations.test.tsx(three hits across "Moving a Range Decoration", "Undoing a local edit that moves a Range Decoration reports a local origin" and "Drawing a collapsed Range Decoration inside a callout"). The Playwright traces show the decoration already in the DOM about 700 ms before the assertion, and the locator round trip returning 1.1 to 1.3 s later, after the 1 s deadline. A trivial() => 0evaluation right after was also delayed by up to 670 ms. A full Chromium run at 6x CPU throttling, with the hook timed, logged six collections between 1.0 and 1.8 s, and a CDP profile around the call attributes the time to the garbage collector, not editor code.Vitest 5.0.5, which the repo already runs, ships the built-in trigger the hook's comment was waiting for (vitest-dev/vitest#10912). It runs between files, outside test execution, and only collects when the temp directory has less than 4 GiB free, so the disk protection stays without the per-file pause.
Note
Low Risk
Test-only Vitest/browser harness change with no production runtime impact; relies on Vitest’s built-in GC instead of the removed workaround.
Overview
Removes the browser Vitest
setupFileshook and deletesvitest.setup.ts, which previously forcedHeapProfiler.collectGarbageover CDP after each Chromium test file to mitigate a Vitest/Chromium shared-memory leak on cached module responses.The setup file is also dropped from
TEST_COMPILED_SOURCESso the React compiler no longer treats it as test harness code. Disk protection against the leak is expected from Vitest 5.0.5’s built-in between-file GC (only when free temp space is low), avoiding stop-the-world collections that were blocking concurrent browser files and causingwaitFortimeouts in range-decoration tests.Reviewed by Cursor Bugbot for commit 6b853d2. Bugbot is set up for automated code reviews on this repo. Configure here.