You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **Default:** [`'default'`](/guide/reporters#default-reporter) (or <code>[['default'](/guide/reporters#default-reporter), ['github-actions'](/guide/reporters#github-actions-reporter)]</code> when `process.env.GITHUB_ACTIONS === 'true'`)
17
+
- **Default:** [`'default'`](/guide/reporters#default-reporter). See [Default Reporters](/guide/reporters#default-reporters) for environment-specific behavior.
18
18
- **CLI:**
19
19
- `--reporter=tap` for a single reporter
20
20
- `--reporter=verbose --reporter=github-actions` for multiple reporters
@@ -49,14 +49,14 @@ Note that the [coverage](/guide/coverage) feature uses a different [`coverage.re
Copy file name to clipboardExpand all lines: docs/guide/reporters.md
+27-19Lines changed: 27 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ outline: deep
5
5
6
6
# Reporters
7
7
8
-
Vitest provides several built-in reporters to display test output in different formats, as well as the ability to use custom reporters. You can select different reporters either by using the `--reporter` command line option, or by including a `reporters` property in your [configuration file](/config/reporters). If no reporter is specified, Vitest will use the `default` reporter as described below.
8
+
Vitest provides several built-in reporters to display test output in different formats, as well as the ability to use custom reporters. You can select different reporters either by using the `--reporter` command line option, or by including a `reporters` property in your [configuration file](/config/reporters). If no reporter is specified, Vitest [auto-selects reporters](#default-configuration) based on the environment.
9
9
10
10
Using reporters via command line:
11
11
@@ -38,6 +38,26 @@ export default defineConfig({
38
38
})
39
39
```
40
40
41
+
## Default Configuration
42
+
43
+
When `reporters` is not configured, Vitest uses the following reporters:
44
+
45
+
-[`default`](#default-reporter) in normal terminal runs
46
+
-[`minimal`](#minimal-reporter) when Vitest detects an AI coding agent
47
+
-[`github-actions`](#github-actions-reporter) is added when `process.env.GITHUB_ACTIONS === 'true'`
48
+
49
+
If you configure your own reporters, the configured list replaces the default list. To add a reporter while keeping Vitest's defaults, extend `configDefaults.reporters`:
By default, Vitest's reporters will print their output to the terminal. When using the `json`, `html` or `junit` reporters, you can instead write your tests' output to a file by including an `outputFile`[configuration option](/config/outputfile) either in your Vite configuration file or via CLI.
@@ -96,11 +118,7 @@ This example will write separate JSON and XML reports as well as printing a verb
96
118
97
119
### Default Reporter
98
120
99
-
By default (i.e. if no reporter is specified), Vitest will display summary of running tests and their status at the bottom. Once a suite passes, its status will be reported on top of the summary.
100
-
101
-
::: tip
102
-
When Vitest detects it is running inside an AI coding agent, the [`minimal`](#minimal-reporter) reporter is used instead to reduce output and minimize token usage. You can override this by explicitly configuring the [`reporters`](/config/reporters) option.
103
-
:::
121
+
The `default` reporter displays summary of running tests and their status at the bottom. Once a suite passes, its status will be reported on top of the summary.
104
122
105
123
You can disable the summary by configuring the reporter:
to provide annotations for test failures. This reporter is automatically enabled when the `reporters` option is not configured and`process.env.GITHUB_ACTIONS === 'true'` (on GitHub Actions environment).
571
+
to provide annotations for test failures. This reporter is [enabled automatically](#default-configuration) when`process.env.GITHUB_ACTIONS === 'true'` (on GitHub Actions environment).
You can customize the file paths that are printed in [GitHub's annotation command format](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions) by using the `onWritePath` option. This is useful when running Vitest in a containerized environment, such as Docker, where the file paths may not match the paths in the GitHub Actions environment.
569
577
570
578
```ts
@@ -662,7 +670,7 @@ export default defineConfig({
662
670
Outputs a minimal report containing only failed tests and their error messages. Console logs from passing tests and the summary section are also suppressed.
663
671
664
672
::: tip Agent Reporter
665
-
This reporter is well optimized for AI coding assistants and LLM-based workflows to reduce token usage. It is automatically enabled when no `reporters` option is configured and Vitest detects it is running inside an AI coding agent. If you configure custom reporters, you can explicitly add `minimal` or `agent`:
673
+
This reporter is well optimized for AI coding assistants and LLM-based workflows to reduce token usage. It is [enabled automatically](#default-configuration)when Vitest detects it is running inside an AI coding agent.
Copy file name to clipboardExpand all lines: docs/guide/ui.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ export default defineConfig({
40
40
You can check your coverage report in Vitest UI: see [Vitest UI Coverage](/guide/coverage#vitest-ui) for more details.
41
41
42
42
::: warning
43
-
If you still want to see how your tests are running in real time in the terminal, don't forget to add `default` reporter to `reporters` option: `['default', 'html']`.
43
+
If you still want to see how your tests are running in real time in the terminal, add `configDefaults.reporters`to the `reporters` option: `['html', ...configDefaults.reporters]`.
0 commit comments