Repository navigation
feat(browser): add failure-only trace view mode - #11612
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
# Conflicts: # docs/config/browser/traceview.md # packages/ui/client/components/trace/TraceView.vue # packages/vitest/src/node/config/resolveConfig.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hi-ogawa
marked this pull request as ready for review
October 20, 2026 11:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… mode" This reverts commit 394809a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
sheremet-va
previously approved these changes
Oct 26, 2026
| ariaSnapshot: true, | ||
| } | ||
| const traceViewOptions = typeof traceView === 'object' ? traceView : undefined | ||
| const traceViewMode = |
Member
There was a problem hiding this comment.
I think we should show a warning if traceView.enabled is set. We have logger.deprecate
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sheremet-va
previously approved these changes
Oct 26, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Accepting a mode made the flag consume a following test filter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
hi-ogawa
commented
Oct 26, 2026
Comment on lines
+420
to
+425
| transform(value) { | ||
| if (typeof value === 'boolean') { | ||
| return { mode: value ? 'on' : 'off' } | ||
| } | ||
| return value | ||
| }, |
Collaborator
Author
There was a problem hiding this comment.
This normalization is for avoid triggering traceView.enabled deprecation warning when users enable it through cli --browser.traceView.
sheremet-va
approved these changes
Oct 26, 2026
This was referenced Oct 27, 2026
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.
Trace view records every step of every test and sends each one to the server as it happens, with a snapshot per step, so every passing test pays for it. This PR adds a
'failure-only'mode that keeps traces only for failed tests, at no cost to passing tests. The trace timeline printed on failure (#11594) works the same in this mode, because it reads the failed test's trace.Usage
browser.traceView.enabledis deprecated in favor ofbrowser.traceView.mode, which covers the same on and off switch and also selects the new mode.Performance
'failure-only'adds no measurable cost to passing tests. Each number below is the average time of one operation in a passing test over 100 calls after 10 warmup calls, taking the median of 3 runs on macOS (Apple Silicon) with headless chromium. The page has a 1000-row list, so the per-step DOM snapshot of'on'shows up clearly.'failure-only''on'clickexpect.elementassertionReal suites with small pages see less overhead from
'on'. For example,test/browseron chromium (135 passing tests) takes about 3.9s with trace view off, 3.9–4.0s with'failure-only', and 4.2s with'on'.A failed test in
'failure-only'takes one snapshot and sends its trace once at the end. That cost isn't measured here.A passing test still records each step in the browser. The main cost is capturing the step's location with
new Error().stack, about 0.004 ms per step, plus a small entry object with a timestamp. It never takes a snapshot, loads the snapshot library, or sends anything to the server, so its cost is effectively zero. That makes'failure-only'a candidate for the default trace view mode, which is left as a follow-up.Reproduction
vitest.config.tsbench.test.tsImplementation
The idea is:
rrweb-snapshotat the time of first snapshotBrowserTraceEntryarray on client side till end instead of sending each entry via rpconAfterRetryTask