docs/config/reporters.md
interface UserConfig {
reporters?: ConfigReporter | Array<ConfigReporter>
}
type ConfigReporter = string | Reporter | [string, object?]
'default' (or <code>['default', 'github-actions']</code> when process.env.GITHUB_ACTIONS === 'true')--reporter=tap for a single reporter--reporter=verbose --reporter=github-actions for multiple reportersThis 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.
:::
defaultverbosetreedotjunitjsonhtmltaptap-flathanging-processgithub-actionsminimal (aliased as agent)blob::: code-group
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' }
],
]
}
})
vitest --reporter=github-actions --reporter=junit
:::