Reporters
Select reporters via --reporter or reporters config. Configuring reporters replaces the default list — spread configDefaults.reporters to keep them.
import { configDefaults, defineConfig } from 'vitest/config'
export default defineConfig({
test: {
reporters: ['verbose', ['junit', { suiteName: 'UI tests' }]],
// keep defaults and add one:
// reporters: ['json', ...configDefaults.reporters],
},
})Default Selection
When reporters is unset, Vitest auto-selects:
defaultfor normal terminal runsminimal(aliasagent) when it detects an AI coding agent — only failed tests + errors, no summary or passing logs, optimized to cut token usagegithub-actionsis added whenprocess.env.GITHUB_ACTIONS === 'true'
Built-in Reporters
| Reporter | Use |
|---|---|
default |
Summary + collapses passing files; prints full tree for single/failing file |
verbose |
One line per finished test (flat list in v4); only reporter that shows annotations on pass |
tree |
Like default but always shows each test (the old v3 verbose) |
dot |
One dot per test; details only for failures |
minimal / agent |
Failures only; best for AI/LLM workflows |
junit |
JUnit XML (templated, see below) |
json |
Jest-compatible JSON; includes coverageMap when coverage enabled |
tap / tap-flat |
TAP (nested / flat) |
html |
Interactive UI report (needs @vitest/ui) |
blob |
Serialized results for --merge-reports |
github-actions |
Workflow annotations + job summary |
hanging-process |
Lists processes preventing exit (debugging) |
v4 removed the
basicreporter (equivalent to['default', { summary: false }]). The oldverboseflat behavior moved here; usetreefor the nested view.
Output Files
v5: the
jsonandjunitreporters now write to a file by default (.vitest/json/output.json,.vitest/junit/output.xml) instead of stdout. If you piped output (vitest --reporter=json | jq), read the artifact instead or opt back in withreporters: [['json', { stdout: true }]]. An explicitoutputFileis still respected.
vitest --reporter=json --outputFile=./test-output.jsondefineConfig({
test: {
reporters: ['junit', 'json'],
outputFile: { junit: './junit.xml', json: './report.json' },
},
})JUnit Templating
reporters: [['junit', {
suiteNameTemplate: '{title}', // {title} {filename} {basename} {displayName}
classnameTemplate: '{classname}', // {classname} {title} {suitename} {filename} ...
titleTemplate: '{title}',
ancestorSeparator: ' > ',
addFileAttribute: true,
}]]{filename} is the relative path (use {basename} for the bare name). Templates can also be functions receiving all variables.
HTML Report (v5 paths)
The HTML reporter writes a directory via outputDir (default .vitest); the entry is <outputDir>/index.html. Use singleFile: true for a self-contained shareable file (large; coverage not inlined).
reporters: [['html', { singleFile: true }]]Blob & Merge (CI/sharding)
Blobs default to .vitest/blob/. Label environments with VITEST_BLOB_LABEL or the reporter label option:
vitest run --reporter=blob --outputFile=reports/blob-1.json
vitest --merge-reports=reports --reporter=junit --reporter=defaultBlob reports don't include file attachments — merge attachmentsDir (.vitest/attachments/) separately. --reporter=blob/--merge-reports don't work in watch mode.
Key Points
- Configuring
reportersreplaces defaults — spreadconfigDefaults.reportersto keep them - The
minimal/agentreporter is auto-selected for AI agents and minimizes token usage - Use
treefor the nested per-test view (old v3verbose) - v5 artifacts (blob, attachments, HTML) live under
.vitest/