Skip to content

test: drop the forced Chromium GC after each browser test file - #3512

Merged
christianhg merged 1 commit into
mainfrom
test/drop-forced-chromium-gc
Oct 29, 2026
Merged

christianhg merged 1 commit into
mainfrom
test/drop-forced-chromium-gc

Conversation

@christianhg

@christianhg christianhg commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

The browser project's setup file sent HeapProfiler.collectGarbage over CDP after every test file, to work around Chromium leaking shared memory on 304 Not Modified module 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 in range-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 () => 0 evaluation 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 setupFiles hook and deletes vitest.setup.ts, which previously forced HeapProfiler.collectGarbage over 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_SOURCES so 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 causing waitFor timeouts in range-decoration tests.

Reviewed by Cursor Bugbot for commit 6b853d2. Bugbot is set up for automated code reviews on this repo. Configure here.

`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.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
portable-text-editor-documentation Ready Ready Preview Oct 29, 2026 1:04am UTC
portable-text-example-basic Ready Ready Preview Oct 29, 2026 1:04am UTC
portable-text-playground Ready Ready Preview Oct 29, 2026 1:04am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6b853d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Stats

✅ No significant changes.

All scenario measurements (37)

🗺️ @portabletext/block-tools / @portabletext/block-tools · @portabletext/block-tools / @portabletext/block-tools/rules · @portabletext/editor / @portabletext/editor · @portabletext/editor / @portabletext/editor/behaviors · @portabletext/editor / @portabletext/editor/plugins · @portabletext/editor / @portabletext/editor/selectors · @portabletext/editor / @portabletext/editor/traversal · @portabletext/editor / @portabletext/editor/utils · @portabletext/editor / defineSchema · @portabletext/editor / useEditor · @portabletext/editor / typical · @portabletext/html / @portabletext/html · @portabletext/html / @portabletext/html/rules · @portabletext/html / htmlToPortableText · @portabletext/keyboard-shortcuts / @portabletext/keyboard-shortcuts · @portabletext/markdown / @portabletext/markdown · @portabletext/markdown / portableTextToMarkdown · @portabletext/patches / @portabletext/patches · @portabletext/repair / @portabletext/repair · @portabletext/sanity-bridge / @portabletext/sanity-bridge · @portabletext/schema / @portabletext/schema · @portabletext/plugin-character-pair-decorator / @portabletext/plugin-character-pair-decorator · @portabletext/plugin-decorations / @portabletext/plugin-decorations · @portabletext/plugin-dnd / @portabletext/plugin-dnd · @portabletext/plugin-emoji-picker / @portabletext/plugin-emoji-picker · @portabletext/plugin-input-rule / @portabletext/plugin-input-rule · @portabletext/plugin-list-index / @portabletext/plugin-list-index · @portabletext/plugin-markdown-shortcuts / @portabletext/plugin-markdown-shortcuts · @portabletext/plugin-one-line / @portabletext/plugin-one-line · @portabletext/plugin-paste-link / @portabletext/plugin-paste-link · @portabletext/plugin-sdk-value / @portabletext/plugin-sdk-value · @portabletext/plugin-typeahead-picker / @portabletext/plugin-typeahead-picker · @portabletext/plugin-typography / @portabletext/plugin-typography · @portabletext/toolbar / @portabletext/toolbar · @portabletext/toolbar / typical · @portabletext/plugin-table / @portabletext/plugin-table · @portabletext/plugin-table / @portabletext/plugin-table/ui · Artifacts

Scenario Kind Bundle (raw / gzip) Gzip change Import time Import change
⚪ @portabletext/block-tools / @portabletext/block-tools export 338.0 KB / 40.0 KB None 191 ms +1 ms, +0.5%
⚪ @portabletext/block-tools / @portabletext/block-tools/rules export 15.2 KB / 2.1 KB None 5 ms +0 ms, +4.3%
⚪ @portabletext/editor / @portabletext/editor export 1.02 MB / 129.6 KB None 74 ms +2 ms, +2.6%
⚪ @portabletext/editor / @portabletext/editor/behaviors export 4.0 KB / 147 B None 2 ms -0 ms, -0.1%
⚪ @portabletext/editor / @portabletext/editor/plugins export 5.1 KB / 645 B None 7 ms -0 ms, -2.8%
⚪ @portabletext/editor / @portabletext/editor/selectors export 94.5 KB / 9.2 KB None 8 ms -0 ms, -5.3%
⚪ @portabletext/editor / @portabletext/editor/traversal export 43.5 KB / 4.0 KB None 6 ms -0 ms, -5.4%
⚪ @portabletext/editor / @portabletext/editor/utils export 33.5 KB / 4.1 KB None 6 ms -0 ms, -0.3%
⚪ @portabletext/editor / defineSchema consumer 658 B / 69 B None None None
⚪ @portabletext/editor / typical consumer 1.01 MB / 129.3 KB None None None
⚪ @portabletext/editor / useEditor consumer 1.6 KB / 248 B None None None
⚪ @portabletext/html / @portabletext/html export 69.3 KB / 10.1 KB None 8 ms +0 ms, +0.8%
⚪ @portabletext/html / @portabletext/html/rules export 15.2 KB / 2.1 KB None 5 ms +0 ms, +0.1%
⚪ @portabletext/html / htmlToPortableText consumer 69.3 KB / 10.1 KB None None None
⚪ @portabletext/keyboard-shortcuts / @portabletext/keyboard-shortcuts export 7.0 KB / 858 B None 2 ms -0 ms, -3.4%
⚪ @portabletext/markdown / @portabletext/markdown export 419.8 KB / 65.7 KB None 39 ms +1 ms, +3.7%
⚪ @portabletext/markdown / portableTextToMarkdown consumer 86.8 KB / 12.0 KB None None None
⚪ @portabletext/patches / @portabletext/patches export 50.0 KB / 7.7 KB None 4 ms -0 ms, -0.9%
⚪ @portabletext/plugin-character-pair-decorator / @portabletext/plugin-character-pair-decorator export 123.9 KB / 15.8 KB None None None
⚪ @portabletext/plugin-decorations / @portabletext/plugin-decorations export 16.4 KB / 2.3 KB None None None
⚪ @portabletext/plugin-dnd / @portabletext/plugin-dnd export 10.4 KB / 1.8 KB None None None
⚪ @portabletext/plugin-emoji-picker / @portabletext/plugin-emoji-picker export 149.8 KB / 18.5 KB None None None
⚪ @portabletext/plugin-input-rule / @portabletext/plugin-input-rule export 124.0 KB / 15.7 KB None None None
⚪ @portabletext/plugin-list-index / @portabletext/plugin-list-index export 7.4 KB / 1.1 KB None None None
⚪ @portabletext/plugin-markdown-shortcuts / @portabletext/plugin-markdown-shortcuts export 136.2 KB / 17.6 KB None None None
⚪ @portabletext/plugin-one-line / @portabletext/plugin-one-line export 2.6 KB / 608 B None None None
⚪ @portabletext/plugin-paste-link / @portabletext/plugin-paste-link export 4.3 KB / 1.0 KB None None None
⚪ @portabletext/plugin-sdk-value / @portabletext/plugin-sdk-value export 242.1 KB / 32.8 KB None None None
⚪ @portabletext/plugin-table / @portabletext/plugin-table export 61.0 KB / 7.1 KB None None None
⚪ @portabletext/plugin-table / @portabletext/plugin-table/ui export 114.6 KB / 19.5 KB None None None
⚪ @portabletext/plugin-typeahead-picker / @portabletext/plugin-typeahead-picker export 165.9 KB / 19.9 KB None None None
⚪ @portabletext/plugin-typography / @portabletext/plugin-typography export 130.8 KB / 17.0 KB None None None
⚪ @portabletext/repair / @portabletext/repair export 4.5 KB / 636 B None 3 ms +0 ms, +2.8%
⚪ @portabletext/sanity-bridge / @portabletext/sanity-bridge export 274.7 KB / 30.2 KB None 186 ms -1 ms, -0.3%
⚪ @portabletext/schema / @portabletext/schema export 9.9 KB / 1.2 KB None 2 ms +0 ms, +1.2%
⚪ @portabletext/toolbar / @portabletext/toolbar export 153.3 KB / 17.3 KB None None None
⚪ @portabletext/toolbar / typical consumer 145.6 KB / 16.9 KB None None None

Significant means at least 1.0 KB and 1% gzip, or at least 5 ms and 10% import time.

This branch was successfully deployed

3 active deployments
Preview – portable-text-editor-documentation — 6b853d27 Deployed Oct 29, 2026 by vercel[bot]
Preview – portable-text-playground — 6b853d27 Deployed Oct 29, 2026 by vercel[bot]
Preview – portable-text-example-basic — 6b853d27 Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant