Skip to content

test(e2e): silence timing-dependent Vite logs in vitest browser fixture - #762

Merged
wan9chi merged 1 commit into
mainfrom
test/vitest-browser-silence-optimizer-logs
Sep 27, 2026
Merged

wan9chi merged 1 commit into
mainfrom
test/vitest-browser-silence-optimizer-logs

Conversation

@wan9chi

@wan9chi wan9chi commented Sep 27, 2026

Copy link
Copy Markdown
Member

Motivation

vitest_browser_cache fails every so often on macOS x64 CI because an extra line shows up in the snapshot:

+2:09:21 AM [vite] (client) [optimizer] scanning dependencies...

Recent failures: 36318877151 (attempt 1), 36087090263, 36084775576, 36084774143, 31664423600.

Vite's dependency optimizer prints [optimizer] scanning dependencies... if the scan takes longer than 1s, and [optimizer] bundling dependencies... if bundling does. Both depend on how fast the runner is.

Change

Run the fixture's task as VITEST_BROWSER_DEBUG=false vitest run.

Vitest browser mode hard-codes the browser server's Vite log level to process.env.VITEST_BROWSER_DEBUG ?? "info", so logLevel in the config has no effect. "false" is the only value that silences that logger without also turning on the browser-side debug output. Any other non-empty value, warn included, turns on client debug RPC logs that contain session IDs, ports and timings.

I forced both timers to fire with artificially slow plugins. Without the variable, both messages were printed; with it, neither was. The test result line and the JSON report output were unaffected.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +1.74%  [-13.56% .. +20.36%]  overhead  +285.25%
dynamic/access             change  +1.35%  [ -3.71% ..  +7.20%]  overhead   +20.05%
dynamic/access-relative    change  +0.00%  [ -3.31% ..  +4.14%]  overhead   +66.26%
dynamic/access-contended   change  -0.73%  [ -7.41% ..  +5.21%]  overhead   +35.78%
static/launch              change  +1.03%  [ -8.73% .. +13.86%]  overhead  +698.25%
static/access              change  +0.17%  [ -0.71% ..  +1.22%]  overhead +1459.98%
static/access-relative     change  -0.35%  [ -1.54% ..  +0.56%]  overhead +1941.13%
static/access-contended    change  -0.17%  [ -1.29% ..  +0.50%]  overhead +1686.01%

macos

dynamic/launch             change  -0.37%  [ -5.19% ..  +5.00%]  overhead  +219.94%
dynamic/access             change  -2.24%  [-15.27% ..  +9.24%]  overhead    +2.00%
dynamic/access-relative    change  +1.27%  [ -3.57% ..  +6.15%]  overhead  +264.80%
dynamic/access-contended   change  -0.53%  [ -9.96% ..  +3.81%]  overhead    +1.72%

windows

dynamic/launch             change  -0.06%  [ -5.22% ..  +7.84%]  overhead   +23.05%
dynamic/access             change  -0.35%  [ -2.43% ..  +2.34%]  overhead    +1.96%
dynamic/access-relative    change  +0.00%  [ -1.36% ..  +1.06%]  overhead    +1.63%
dynamic/access-contended   change  -0.17%  [ -1.53% ..  +1.39%]  overhead    +1.61%

Vite's dependency optimizer prints "[optimizer] scanning dependencies..."
and "[optimizer] bundling dependencies..." when those phases exceed 1s,
which occasionally happens on macOS x64 CI runners and breaks the
vitest_browser_cache snapshot. Vitest browser mode hard-codes the browser
server's log level to VITEST_BROWSER_DEBUG ?? "info"; "false" is the only
value that silences that logger without enabling browser-side debug output.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the test/vitest-browser-silence-optimizer-logs branch from d1fbdea to a5e5046 Compare September 27, 2026 13:20
@wan9chi
wan9chi merged commit 6b2f5f7 into main Sep 27, 2026
19 checks passed
@wan9chi
wan9chi deleted the test/vitest-browser-silence-optimizer-logs branch September 27, 2026 13:26
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