Skip to content

browser.traceView 5.0.0+ ​

  • Type: boolean | 'off' | 'on' | 'failure-only' | { mode?: 'off' | 'on' | 'failure-only'; recordCanvas?: boolean; inlineImages?: boolean; ariaSnapshot?: boolean }
  • CLI: --browser.traceView
  • Default: 'failure-only'

Records the actions, assertions, and marks of browser tests with DOM snapshots, so you can replay them in the trace viewer. Failed tests also print their recorded steps in the terminal, as described in Failure Output.

  • 'failure-only' records only failed tests. This is the default.
  • true or 'on' records every test.
  • false or 'off' turns trace view off.
  • An object sets mode together with the options below.
ts
export default defineConfig({
  test: {
    browser: {
      traceView: {
        mode: 'on',
        inlineImages: true,
      },
    },
  },
})

browser.traceView.mode 5.1.0+ ​

  • Type: 'off' | 'on' | 'failure-only'
  • Default: 'failure-only'
  • CLI: --browser.traceView.mode <mode>

How trace view records tests:

  • 'on': every test gets a trace with a snapshot at every step, and Vitest UI shows steps live as tests run.
  • 'failure-only': only failed tests get a trace, with the full step timeline and a snapshot at the end.
  • 'off': no traces.

browser.traceView.inlineImages ​

  • Type: boolean
  • Default: false
  • CLI: --browser.traceView.inlineImages

Inlines loaded <img> pixels into snapshots, so the HTML report renders them without loading the original URLs. See Snapshot Fidelity for what is and is not captured.

browser.traceView.recordCanvas ​

  • Type: boolean
  • Default: false
  • CLI: --browser.traceView.recordCanvas

Captures canvas pixels in snapshots. The trace viewer then allows scripts in its replay iframe, because rrweb needs them 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 can then switch from the DOM snapshot to an Aria view, which uses the same format as aria snapshots.

browser.traceView.enabled deprecated ​

  • Type: boolean
  • CLI: --browser.traceView.enabled

Use mode instead. true is the same as mode: 'on', and false is the same as mode: 'off'. When both are set, mode wins.