Repository navigation
test(Tokenizer): the SSR test asserts no console error instead of muting it - #8766
Merged
Merged
Conversation
…hes each case's sheet load Each case hydrates a fresh module graph (`vi.resetModules()`, then an import of Tokenizer's entry). The first case paid the graph's transform inside its 30 s budget, about 3.4 s alone and many times that on a busy machine, where it timed out. Its work then kept running, and a coarse-pointer case's on-demand sheet load resolved during the next case's hydration, which reported "This root received an early update". The entry and its sheet now load while the file is collected, which is untimed, so each fresh graph only runs the modules again. A coarse-pointer case finishes the sheet load its hydration starts before it unmounts, and a case that ends early has its hydration finish before the next case starts.
…ing it The hydration test silenced console.error and checked only React's recoverable errors, but React reports some mismatches only on the console: an attribute whose server value differs from the client's, for one. Nothing is logged today (all three hydrations log no console error), so the mute hid nothing yet; it would have hidden the next such mismatch. The test now watches console.error without muting it and asserts each hydration logs none. Red first: with the server markup's aria-expanded tampered so it differs at hydration, the muted test passed (no recoverable error) and this one fails in all three cases, naming the console error.
vjeux
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
October 28, 2026 00:08
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
This looks good to merge once CI finishes: watching console.error instead of muting it lets the Tokenizer SSR test catch hydration mismatches that React reports only on the console, the same shape DropdownMenu's SSR test uses. The tampered-markup check in the description holds up: with aria-expanded flipped in the server markup, the old test stays green and the new one fails all three cases on React's attribute-mismatch error. No changes are needed.
[Automated review]
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #8760 (merged). Review only this PR's change: vjeux/astryx@ad19aec...2e04bc8
Maintainer impact
Tokenizer.ssr.test.tsxmutesconsole.errorand checks only React's recoverable errors. React reports some hydration mismatches only on the console: an attribute whose server value differs from the client's, for one. So a hydration that leaves a wrong attribute on the page passes this test. Nothing is logged today, so the mute hides nothing yet; it would hide the next such mismatch.What led here: while fixing this file's timeouts in #8760, I saw the mute; #8685 had already found and replaced the same mute in DropdownMenu's SSR test.
Intended invariant
A hydration the test calls clean logs no console error.
Change
Options weighed:
console.errorwithout muting it and assert each hydration logs nothing. Chosen: it catches every logged error, and it is the shape test(DropdownMenu): the SSR test loads the menu and its sheet at collection #8685 uses, so the two SSR tests read the same.Evidence
How to check: in
serverRenderThenHydrate, tamper the server markup withhtml.replace('aria-expanded="false"', 'aria-expanded="true"')and runpnpm vitest run packages/core/src/Tokenizer/Tokenizer.ssr.test.tsx.Scope
Testing