reporters
- Type:
ts
interface UserConfig {
reporters?: ConfigReporter | Array<ConfigReporter>
}
type ConfigReporter = string | Reporter | [string, object?]- Default:
'default' - CLI:
--reporter=tapfor a single reporter--reporter=verbose --reporter=github-actionsfor multiple reporters
This option defines a single reporter or a list of reporters available to Vitest during the test run.
Alongside built-in reporters, you can also pass down a custom implementation of a Reporter interface, or a path to a module that exports it as a default export (e.g. './path/to/reporter.ts', '@scope/reporter').
You can configure a reporter by providing a tuple: [string, object], where the string is a reporter name, and the object is the reporter's options.
WARNING
Note that the coverage feature uses a different coverage.reporter option instead of this one.
Built-in Reporters
Example
js
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
reporters: [
'default',
// conditional reporter
process.env.CI ? 'github-actions' : {},
// custom reporter from npm package
// options are passed down as a tuple
[
'vitest-sonar-reporter',
{ outputFile: 'sonar-report.xml' }
],
]
}
})bash
vitest --reporter=github-actions --reporter=junit