browser.traceView 5.0.0+
- Type:
boolean | { enabled?: boolean; recordCanvas?: boolean; inlineImages?: boolean; ariaSnapshot?: boolean } - CLI:
--browser.traceView - Default:
false
Enable trace view collection for browser tests. Vitest captures DOM snapshots for browser interactions and can show them in the browser UI, Vitest UI, or HTML reporter when those surfaces are enabled — no external tools required. When a test fails, the terminal output also includes a timeline of its recorded steps.
export default defineConfig({
test: {
browser: {
traceView: true,
},
},
})Use the object form to enable additional snapshot fidelity options:
export default defineConfig({
test: {
browser: {
traceView: {
enabled: true,
inlineImages: true,
recordCanvas: true,
},
},
},
})| Option | Default | Description |
|---|---|---|
enabled | false | Enables Vitest trace-view artifact collection. |
inlineImages | false | Inlines loaded <img> pixels into snapshots for more portable replay, useful in the HTML reporter. |
recordCanvas | false | Captures canvas pixels in snapshots. |
ariaSnapshot | true | Captures the accessibility tree alongside each snapshot. |
browser.traceView.enabled
- Type:
boolean - Default:
false - CLI:
--browser.traceView.enabled
Enables Vitest trace-view artifact collection.
browser.traceView.inlineImages
- Type:
boolean - Default:
false - CLI:
--browser.traceView.inlineImages
Inlines loaded <img> pixels into snapshots for more portable replay, useful in the HTML reporter.
browser.traceView.recordCanvas
- Type:
boolean - Default:
false - CLI:
--browser.traceView.recordCanvas
Captures canvas pixels in snapshots. This enables a weaker replay iframe sandbox because rrweb needs scripts to redraw canvas data.
browser.traceView.ariaSnapshot 5.1.0+
- Type:
boolean - Default:
true - CLI:
--browser.traceView.ariaSnapshot
Captures the accessibility tree of the page alongside each snapshot. The trace viewer header can then switch from the DOM snapshot to an Aria view, which uses the same format as aria snapshots.
See Trace View for full documentation.