@vitest-agent/mcp 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +1 -2
  2. package/index.d.ts +3 -2
  3. package/index.js +1 -1
  4. package/package.json +1 -1
  5. package/server.js +2 -4
  6. package/tools/run-tests.js +17 -3
  7. package/patterns/_meta.json +0 -67
  8. package/patterns/authoring-a-custom-vitest-agent-reporter.md +0 -82
  9. package/patterns/known-issues-and-caveats.md +0 -52
  10. package/patterns/operating-vitest-agent-as-an-agent.md +0 -62
  11. package/patterns/running-tests-via-mcp.md +0 -103
  12. package/patterns/silencing-leaking-output-in-tests.md +0 -91
  13. package/patterns/testing-effect-schema-definitions.md +0 -71
  14. package/patterns/testing-effect-services-with-mock-layers.md +0 -63
  15. package/resources/index.js +0 -166
  16. package/resources/indexes.js +0 -77
  17. package/resources/manifest-schema.js +0 -46
  18. package/resources/paths.js +0 -20
  19. package/resources/patterns.js +0 -22
  20. package/resources/upstream-docs.js +0 -22
  21. package/vendor/vitest-docs/ATTRIBUTION.md +0 -5
  22. package/vendor/vitest-docs/api/advanced/artifacts.md +0 -189
  23. package/vendor/vitest-docs/api/advanced/metadata.md +0 -68
  24. package/vendor/vitest-docs/api/advanced/plugin.md +0 -168
  25. package/vendor/vitest-docs/api/advanced/reporters.md +0 -342
  26. package/vendor/vitest-docs/api/advanced/runner.md +0 -334
  27. package/vendor/vitest-docs/api/advanced/test-case.md +0 -302
  28. package/vendor/vitest-docs/api/advanced/test-collection.md +0 -89
  29. package/vendor/vitest-docs/api/advanced/test-module.md +0 -140
  30. package/vendor/vitest-docs/api/advanced/test-project.md +0 -321
  31. package/vendor/vitest-docs/api/advanced/test-specification.md +0 -96
  32. package/vendor/vitest-docs/api/advanced/test-suite.md +0 -230
  33. package/vendor/vitest-docs/api/advanced/vitest.md +0 -684
  34. package/vendor/vitest-docs/api/assert-type.md +0 -22
  35. package/vendor/vitest-docs/api/assert.md +0 -1960
  36. package/vendor/vitest-docs/api/browser/assertions.md +0 -1277
  37. package/vendor/vitest-docs/api/browser/commands.md +0 -154
  38. package/vendor/vitest-docs/api/browser/context.md +0 -338
  39. package/vendor/vitest-docs/api/browser/interactivity.md +0 -681
  40. package/vendor/vitest-docs/api/browser/locators.md +0 -1171
  41. package/vendor/vitest-docs/api/browser/react.md +0 -346
  42. package/vendor/vitest-docs/api/browser/svelte.md +0 -292
  43. package/vendor/vitest-docs/api/browser/vue.md +0 -222
  44. package/vendor/vitest-docs/api/describe.md +0 -374
  45. package/vendor/vitest-docs/api/expect-typeof.md +0 -571
  46. package/vendor/vitest-docs/api/expect.md +0 -2304
  47. package/vendor/vitest-docs/api/hooks.md +0 -463
  48. package/vendor/vitest-docs/api/mock.md +0 -701
  49. package/vendor/vitest-docs/api/test.md +0 -926
  50. package/vendor/vitest-docs/api/vi.md +0 -1372
  51. package/vendor/vitest-docs/config/alias.md +0 -13
  52. package/vendor/vitest-docs/config/allowonly.md +0 -32
  53. package/vendor/vitest-docs/config/api.md +0 -27
  54. package/vendor/vitest-docs/config/attachmentsdir.md +0 -6
  55. package/vendor/vitest-docs/config/bail.md +0 -9
  56. package/vendor/vitest-docs/config/benchmark.md +0 -65
  57. package/vendor/vitest-docs/config/browser/api.md +0 -23
  58. package/vendor/vitest-docs/config/browser/commands.md +0 -6
  59. package/vendor/vitest-docs/config/browser/connecttimeout.md +0 -10
  60. package/vendor/vitest-docs/config/browser/detailspanelposition.md +0 -38
  61. package/vendor/vitest-docs/config/browser/enabled.md +0 -40
  62. package/vendor/vitest-docs/config/browser/expect.md +0 -250
  63. package/vendor/vitest-docs/config/browser/headless.md +0 -7
  64. package/vendor/vitest-docs/config/browser/instances.md +0 -47
  65. package/vendor/vitest-docs/config/browser/isolate.md +0 -11
  66. package/vendor/vitest-docs/config/browser/locators.md +0 -24
  67. package/vendor/vitest-docs/config/browser/orchestratorscripts.md +0 -39
  68. package/vendor/vitest-docs/config/browser/playwright.md +0 -214
  69. package/vendor/vitest-docs/config/browser/preview.md +0 -32
  70. package/vendor/vitest-docs/config/browser/provider.md +0 -79
  71. package/vendor/vitest-docs/config/browser/screenshotdirectory.md +0 -6
  72. package/vendor/vitest-docs/config/browser/screenshotfailures.md +0 -6
  73. package/vendor/vitest-docs/config/browser/testerhtmlpath.md +0 -5
  74. package/vendor/vitest-docs/config/browser/trace.md +0 -43
  75. package/vendor/vitest-docs/config/browser/trackunhandlederrors.md +0 -10
  76. package/vendor/vitest-docs/config/browser/ui.md +0 -7
  77. package/vendor/vitest-docs/config/browser/viewport.md +0 -6
  78. package/vendor/vitest-docs/config/browser/webdriverio.md +0 -64
  79. package/vendor/vitest-docs/config/cache.md +0 -26
  80. package/vendor/vitest-docs/config/chaiconfig.md +0 -29
  81. package/vendor/vitest-docs/config/clearmocks.md +0 -22
  82. package/vendor/vitest-docs/config/coverage.md +0 -455
  83. package/vendor/vitest-docs/config/css.md +0 -47
  84. package/vendor/vitest-docs/config/dangerouslyignoreunhandlederrors.md +0 -23
  85. package/vendor/vitest-docs/config/deps.md +0 -127
  86. package/vendor/vitest-docs/config/detectasyncleaks.md +0 -39
  87. package/vendor/vitest-docs/config/diff.md +0 -96
  88. package/vendor/vitest-docs/config/dir.md +0 -7
  89. package/vendor/vitest-docs/config/disableconsoleintercept.md +0 -15
  90. package/vendor/vitest-docs/config/env.md +0 -5
  91. package/vendor/vitest-docs/config/environment.md +0 -96
  92. package/vendor/vitest-docs/config/environmentoptions.md +0 -30
  93. package/vendor/vitest-docs/config/exclude.md +0 -49
  94. package/vendor/vitest-docs/config/execargv.md +0 -10
  95. package/vendor/vitest-docs/config/expandsnapshotdiff.md +0 -7
  96. package/vendor/vitest-docs/config/expect.md +0 -38
  97. package/vendor/vitest-docs/config/experimental.md +0 -510
  98. package/vendor/vitest-docs/config/faketimers.md +0 -51
  99. package/vendor/vitest-docs/config/fileparallelism.md +0 -11
  100. package/vendor/vitest-docs/config/forcereruntriggers.md +0 -19
  101. package/vendor/vitest-docs/config/globals.md +0 -42
  102. package/vendor/vitest-docs/config/globalsetup.md +0 -72
  103. package/vendor/vitest-docs/config/hideskippedtests.md +0 -7
  104. package/vendor/vitest-docs/config/hooktimeout.md +0 -7
  105. package/vendor/vitest-docs/config/include-source.md +0 -115
  106. package/vendor/vitest-docs/config/include.md +0 -71
  107. package/vendor/vitest-docs/config/includetasklocation.md +0 -17
  108. package/vendor/vitest-docs/config/index.md +0 -85
  109. package/vendor/vitest-docs/config/isolate.md +0 -13
  110. package/vendor/vitest-docs/config/logheapusage.md +0 -7
  111. package/vendor/vitest-docs/config/maxconcurrency.md +0 -9
  112. package/vendor/vitest-docs/config/maxworkers.md +0 -49
  113. package/vendor/vitest-docs/config/mockreset.md +0 -22
  114. package/vendor/vitest-docs/config/mode.md +0 -7
  115. package/vendor/vitest-docs/config/name.md +0 -111
  116. package/vendor/vitest-docs/config/onconsolelog.md +0 -25
  117. package/vendor/vitest-docs/config/onstacktrace.md +0 -32
  118. package/vendor/vitest-docs/config/onunhandlederror.md +0 -35
  119. package/vendor/vitest-docs/config/open.md +0 -7
  120. package/vendor/vitest-docs/config/outputfile.md +0 -7
  121. package/vendor/vitest-docs/config/passwithnotests.md +0 -7
  122. package/vendor/vitest-docs/config/pool.md +0 -45
  123. package/vendor/vitest-docs/config/printconsoletrace.md +0 -6
  124. package/vendor/vitest-docs/config/projects.md +0 -6
  125. package/vendor/vitest-docs/config/provide.md +0 -45
  126. package/vendor/vitest-docs/config/reporters.md +0 -69
  127. package/vendor/vitest-docs/config/resolvesnapshotpath.md +0 -36
  128. package/vendor/vitest-docs/config/restoremocks.md +0 -22
  129. package/vendor/vitest-docs/config/retry.md +0 -140
  130. package/vendor/vitest-docs/config/root.md +0 -6
  131. package/vendor/vitest-docs/config/runner.md +0 -6
  132. package/vendor/vitest-docs/config/sequence.md +0 -158
  133. package/vendor/vitest-docs/config/server.md +0 -68
  134. package/vendor/vitest-docs/config/setupfiles.md +0 -40
  135. package/vendor/vitest-docs/config/silent.md +0 -9
  136. package/vendor/vitest-docs/config/slowtestthreshold.md +0 -7
  137. package/vendor/vitest-docs/config/snapshotenvironment.md +0 -27
  138. package/vendor/vitest-docs/config/snapshotformat.md +0 -28
  139. package/vendor/vitest-docs/config/snapshotserializers.md +0 -6
  140. package/vendor/vitest-docs/config/stricttags.md +0 -30
  141. package/vendor/vitest-docs/config/tags.md +0 -141
  142. package/vendor/vitest-docs/config/teardowntimeout.md +0 -7
  143. package/vendor/vitest-docs/config/testnamepattern.md +0 -21
  144. package/vendor/vitest-docs/config/testtimeout.md +0 -7
  145. package/vendor/vitest-docs/config/typecheck.md +0 -77
  146. package/vendor/vitest-docs/config/ui.md +0 -15
  147. package/vendor/vitest-docs/config/unstubenvs.md +0 -20
  148. package/vendor/vitest-docs/config/unstubglobals.md +0 -20
  149. package/vendor/vitest-docs/config/update.md +0 -16
  150. package/vendor/vitest-docs/config/vmmemorylimit.md +0 -30
  151. package/vendor/vitest-docs/config/watch.md +0 -11
  152. package/vendor/vitest-docs/config/watchtriggerpatterns.md +0 -29
  153. package/vendor/vitest-docs/guide/advanced/index.md +0 -147
  154. package/vendor/vitest-docs/guide/advanced/pool.md +0 -148
  155. package/vendor/vitest-docs/guide/advanced/reporters.md +0 -93
  156. package/vendor/vitest-docs/guide/advanced/tests.md +0 -125
  157. package/vendor/vitest-docs/guide/browser/aria-snapshots.md +0 -470
  158. package/vendor/vitest-docs/guide/browser/component-testing.md +0 -571
  159. package/vendor/vitest-docs/guide/browser/index.md +0 -630
  160. package/vendor/vitest-docs/guide/browser/multiple-setups.md +0 -121
  161. package/vendor/vitest-docs/guide/browser/trace-view.md +0 -126
  162. package/vendor/vitest-docs/guide/browser/visual-regression-testing.md +0 -734
  163. package/vendor/vitest-docs/guide/cli-generated.md +0 -972
  164. package/vendor/vitest-docs/guide/cli.md +0 -234
  165. package/vendor/vitest-docs/guide/common-errors.md +0 -163
  166. package/vendor/vitest-docs/guide/coverage.md +0 -515
  167. package/vendor/vitest-docs/guide/debugging.md +0 -127
  168. package/vendor/vitest-docs/guide/environment.md +0 -101
  169. package/vendor/vitest-docs/guide/extending-matchers.md +0 -160
  170. package/vendor/vitest-docs/guide/features.md +0 -310
  171. package/vendor/vitest-docs/guide/filtering.md +0 -175
  172. package/vendor/vitest-docs/guide/ide.md +0 -43
  173. package/vendor/vitest-docs/guide/improving-performance.md +0 -245
  174. package/vendor/vitest-docs/guide/in-source.md +0 -159
  175. package/vendor/vitest-docs/guide/index.md +0 -128
  176. package/vendor/vitest-docs/guide/learn/async.md +0 -147
  177. package/vendor/vitest-docs/guide/learn/debugging-tests.md +0 -210
  178. package/vendor/vitest-docs/guide/learn/matchers.md +0 -277
  179. package/vendor/vitest-docs/guide/learn/mock-functions.md +0 -277
  180. package/vendor/vitest-docs/guide/learn/setup-teardown.md +0 -240
  181. package/vendor/vitest-docs/guide/learn/snapshots.md +0 -166
  182. package/vendor/vitest-docs/guide/learn/testing-in-practice.md +0 -430
  183. package/vendor/vitest-docs/guide/learn/writing-tests-with-ai.md +0 -127
  184. package/vendor/vitest-docs/guide/learn/writing-tests.md +0 -231
  185. package/vendor/vitest-docs/guide/lifecycle.md +0 -379
  186. package/vendor/vitest-docs/guide/migration.md +0 -863
  187. package/vendor/vitest-docs/guide/mocking/classes.md +0 -158
  188. package/vendor/vitest-docs/guide/mocking/dates.md +0 -52
  189. package/vendor/vitest-docs/guide/mocking/file-system.md +0 -74
  190. package/vendor/vitest-docs/guide/mocking/functions.md +0 -61
  191. package/vendor/vitest-docs/guide/mocking/globals.md +0 -20
  192. package/vendor/vitest-docs/guide/mocking/modules.md +0 -414
  193. package/vendor/vitest-docs/guide/mocking/requests.md +0 -114
  194. package/vendor/vitest-docs/guide/mocking/timers.md +0 -48
  195. package/vendor/vitest-docs/guide/mocking.md +0 -239
  196. package/vendor/vitest-docs/guide/open-telemetry.md +0 -156
  197. package/vendor/vitest-docs/guide/parallelism.md +0 -82
  198. package/vendor/vitest-docs/guide/profiling-test-performance.md +0 -243
  199. package/vendor/vitest-docs/guide/projects.md +0 -291
  200. package/vendor/vitest-docs/guide/recipes.md +0 -59
  201. package/vendor/vitest-docs/guide/reporters.md +0 -723
  202. package/vendor/vitest-docs/guide/snapshot.md +0 -620
  203. package/vendor/vitest-docs/guide/test-annotations.md +0 -103
  204. package/vendor/vitest-docs/guide/test-context.md +0 -902
  205. package/vendor/vitest-docs/guide/test-tags.md +0 -314
  206. package/vendor/vitest-docs/guide/testing-types.md +0 -149
  207. package/vendor/vitest-docs/guide/ui.md +0 -160
  208. package/vendor/vitest-docs/guide/using-plugins.md +0 -5
  209. package/vendor/vitest-docs/manifest.json +0 -1691
@@ -1,723 +0,0 @@
1
- # Reporters
2
-
3
- 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.
4
-
5
- Using reporters via command line:
6
-
7
- ```bash
8
- npx vitest --reporter=verbose
9
- ```
10
-
11
- Using reporters via [`vitest.config.ts`](/config/):
12
-
13
- ```ts
14
- import { defineConfig } from 'vitest/config'
15
-
16
- export default defineConfig({
17
- test: {
18
- reporters: ['verbose']
19
- },
20
- })
21
- ```
22
-
23
- Some reporters can be customized by passing additional options to them. Reporter specific options are described in sections below.
24
-
25
- ```ts
26
- export default defineConfig({
27
- test: {
28
- reporters: [
29
- 'default',
30
- ['junit', { suiteName: 'UI tests' }]
31
- ],
32
- },
33
- })
34
- ```
35
-
36
- ## Reporter Output
37
-
38
- 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.
39
-
40
- :::code-group
41
- ```bash [CLI]
42
- npx vitest --reporter=json --outputFile=./test-output.json
43
- ```
44
-
45
- ```ts [vitest.config.ts]
46
- export default defineConfig({
47
- test: {
48
- reporters: ['json'],
49
- outputFile: './test-output.json'
50
- },
51
- })
52
- ```
53
- :::
54
-
55
- ## Combining Reporters
56
-
57
- You can use multiple reporters simultaneously to print your test results in different formats. For example:
58
-
59
- ```bash
60
- npx vitest --reporter=json --reporter=default
61
- ```
62
-
63
- ```ts
64
- export default defineConfig({
65
- test: {
66
- reporters: ['json', 'default'],
67
- outputFile: './test-output.json'
68
- },
69
- })
70
- ```
71
-
72
- The above example will both print the test results to the terminal in the default style and write them as JSON to the designated output file.
73
-
74
- When using multiple reporters, it's also possible to designate multiple output files, as follows:
75
-
76
- ```ts
77
- export default defineConfig({
78
- test: {
79
- reporters: ['junit', 'json', 'verbose'],
80
- outputFile: {
81
- junit: './junit-report.xml',
82
- json: './json-report.json',
83
- },
84
- },
85
- })
86
- ```
87
-
88
- This example will write separate JSON and XML reports as well as printing a verbose report to the terminal.
89
-
90
- ## Built-in Reporters
91
-
92
- ### Default Reporter
93
-
94
- 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.
95
-
96
- ::: tip
97
- 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.
98
- :::
99
-
100
- You can disable the summary by configuring the reporter:
101
-
102
- :::code-group
103
- ```ts [vitest.config.ts]
104
- export default defineConfig({
105
- test: {
106
- reporters: [
107
- ['default', { summary: false }]
108
- ]
109
- },
110
- })
111
- ```
112
- :::
113
-
114
- Example output for tests in progress:
115
-
116
- ```bash
117
- ✓ test/example-1.test.ts (5 tests | 1 skipped) 306ms
118
- ✓ test/example-2.test.ts (5 tests | 1 skipped) 307ms
119
-
120
- ❯ test/example-3.test.ts 3/5
121
- ❯ test/example-4.test.ts 1/5
122
-
123
- Test Files 2 passed (4)
124
- Tests 10 passed | 3 skipped (65)
125
- Start at 11:01:36
126
- Duration 2.00s
127
- ```
128
-
129
- Final output after tests have finished:
130
-
131
- ```bash
132
- ✓ test/example-1.test.ts (5 tests | 1 skipped) 306ms
133
- ✓ test/example-2.test.ts (5 tests | 1 skipped) 307ms
134
- ✓ test/example-3.test.ts (5 tests | 1 skipped) 307ms
135
- ✓ test/example-4.test.ts (5 tests | 1 skipped) 307ms
136
-
137
- Test Files 4 passed (4)
138
- Tests 16 passed | 4 skipped (20)
139
- Start at 12:34:32
140
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
141
- ```
142
-
143
- If there is only one test file running, Vitest will output the full test tree of that file, similar to the [`tree`](#tree-reporter) reporter. The default reporter will also print the test tree if there is at least one failed test in the file.
144
-
145
- ```bash
146
- ✓ __tests__/file1.test.ts (2) 725ms
147
- ✓ first test file (2) 725ms
148
- ✓ 2 + 2 should equal 4
149
- ✓ 4 - 2 should equal 2
150
-
151
- Test Files 1 passed (1)
152
- Tests 2 passed (2)
153
- Start at 12:34:32
154
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
155
- ```
156
-
157
- ### Verbose Reporter
158
-
159
- The verbose reporter prints every test case once it is finished. It does not report suites or files separately. If `--includeTaskLocation` is enabled, it will also include the location of each test in the output. Similar to `default` reporter, you can disable the summary by configuring the reporter.
160
-
161
- In addition to this, the `verbose` reporter prints test error messages right away. The full test error is reported when the test run is finished.
162
-
163
- This is the only terminal reporter that reports [annotations](/guide/test-annotations) when the test doesn't fail.
164
-
165
- :::code-group
166
- ```bash [CLI]
167
- npx vitest --reporter=verbose
168
- ```
169
-
170
- ```ts [vitest.config.ts]
171
- export default defineConfig({
172
- test: {
173
- reporters: [
174
- ['verbose', { summary: false }]
175
- ]
176
- },
177
- })
178
- ```
179
- :::
180
-
181
- Example output:
182
-
183
- ```bash
184
- ✓ __tests__/file1.test.ts > first test file > 2 + 2 should equal 4 1ms
185
- ✓ __tests__/file1.test.ts > first test file > 4 - 2 should equal 2 1ms
186
- ✓ __tests__/file2.test.ts > second test file > 1 + 1 should equal 2 1ms
187
- ✓ __tests__/file2.test.ts > second test file > 2 - 1 should equal 1 1ms
188
-
189
- Test Files 2 passed (2)
190
- Tests 4 passed (4)
191
- Start at 12:34:32
192
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
193
- ```
194
-
195
- An example with `--includeTaskLocation`:
196
-
197
- ```bash
198
- ✓ __tests__/file1.test.ts:2:1 > first test file > 2 + 2 should equal 4 1ms
199
- ✓ __tests__/file1.test.ts:3:1 > first test file > 4 - 2 should equal 2 1ms
200
- ✓ __tests__/file2.test.ts:2:1 > second test file > 1 + 1 should equal 2 1ms
201
- ✓ __tests__/file2.test.ts:3:1 > second test file > 2 - 1 should equal 1 1ms
202
-
203
- Test Files 2 passed (2)
204
- Tests 4 passed (4)
205
- Start at 12:34:32
206
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
207
- ```
208
-
209
- ### Tree Reporter
210
-
211
- The tree reporter is same as `default` reporter, but it also displays each individual test after the suite has finished. Similar to `default` reporter, you can disable the summary by configuring the reporter.
212
-
213
- :::code-group
214
- ```bash [CLI]
215
- npx vitest --reporter=tree
216
- ```
217
-
218
- ```ts [vitest.config.ts]
219
- export default defineConfig({
220
- test: {
221
- reporters: [
222
- ['tree', { summary: false }]
223
- ]
224
- },
225
- })
226
- ```
227
- :::
228
-
229
- Example output for tests in progress with default `slowTestThreshold: 300`:
230
-
231
- ```bash
232
- ✓ __tests__/example-1.test.ts (2) 725ms
233
- ✓ first test file (2) 725ms
234
- ✓ 2 + 2 should equal 4
235
- ✓ 4 - 2 should equal 2
236
-
237
- ❯ test/example-2.test.ts 3/5
238
- ↳ should run longer than three seconds 1.57s
239
- ❯ test/example-3.test.ts 1/5
240
-
241
- Test Files 2 passed (4)
242
- Tests 10 passed | 3 skipped (65)
243
- Start at 11:01:36
244
- Duration 2.00s
245
- ```
246
-
247
- Example of final terminal output for a passing test suite:
248
-
249
- ```bash
250
- ✓ __tests__/file1.test.ts (2) 725ms
251
- ✓ first test file (2) 725ms
252
- ✓ 2 + 2 should equal 4
253
- ✓ 4 - 2 should equal 2
254
- ✓ __tests__/file2.test.ts (2) 746ms
255
- ✓ second test file (2) 746ms
256
- ✓ 1 + 1 should equal 2
257
- ✓ 2 - 1 should equal 1
258
-
259
- Test Files 2 passed (2)
260
- Tests 4 passed (4)
261
- Start at 12:34:32
262
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
263
- ```
264
-
265
- ### Dot Reporter
266
-
267
- Prints a single dot for each completed test to provide minimal output while still showing all tests that have run. Details are only provided for failed tests, along with the summary for the suite.
268
-
269
- :::code-group
270
- ```bash [CLI]
271
- npx vitest --reporter=dot
272
- ```
273
-
274
- ```ts [vitest.config.ts]
275
- export default defineConfig({
276
- test: {
277
- reporters: ['dot']
278
- },
279
- })
280
- ```
281
- :::
282
-
283
- Example terminal output for a passing test suite:
284
-
285
- ```bash
286
- ....
287
-
288
- Test Files 2 passed (2)
289
- Tests 4 passed (4)
290
- Start at 12:34:32
291
- Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms)
292
- ```
293
-
294
- ### JUnit Reporter
295
-
296
- Outputs a report of the test results in JUnit XML format. Can either be printed to the terminal or written to an XML file using the [`outputFile`](/config/outputfile) configuration option.
297
-
298
- :::code-group
299
- ```bash [CLI]
300
- npx vitest --reporter=junit
301
- ```
302
-
303
- ```ts [vitest.config.ts]
304
- export default defineConfig({
305
- test: {
306
- reporters: ['junit']
307
- },
308
- })
309
- ```
310
- :::
311
-
312
- Example of a JUnit XML report:
313
- ```xml
314
- <?xml version="1.0" encoding="UTF-8" ?>
315
- <testsuites name="vitest tests" tests="2" failures="1" errors="0" time="0.503">
316
- <testsuite name="__tests__/test-file-1.test.ts" timestamp="2023-10-19T17:41:58.580Z" hostname="My-Computer.local" tests="2" failures="1" errors="0" skipped="0" time="0.013">
317
- <testcase classname="__tests__/test-file-1.test.ts" name="first test file &gt; 2 + 2 should equal 4" time="0.01">
318
- <failure message="expected 5 to be 4 // Object.is equality" type="AssertionError">
319
- AssertionError: expected 5 to be 4 // Object.is equality
320
- ❯ __tests__/test-file-1.test.ts:20:28
321
- </failure>
322
- </testcase>
323
- <testcase classname="__tests__/test-file-1.test.ts" name="first test file &gt; 4 - 2 should equal 2" time="0">
324
- </testcase>
325
- </testsuite>
326
- </testsuites>
327
- ```
328
-
329
- The outputted XML contains nested `testsuites` and `testcase` tags. These can also be customized via reporter options `suiteName` and `classnameTemplate`. `classnameTemplate` can either be a template string or a function.
330
-
331
- The supported placeholders for the `classnameTemplate` option are:
332
- - filename
333
- - filepath
334
-
335
- ```ts
336
- export default defineConfig({
337
- test: {
338
- reporters: [
339
- ['junit', { suiteName: 'custom suite name', classnameTemplate: 'filename:{filename} - filepath:{filepath}' }]
340
- ]
341
- },
342
- })
343
- ```
344
-
345
- ### JSON Reporter
346
-
347
- Generates a report of the test results in a JSON format compatible with Jest's `--json` option. Can either be printed to the terminal or written to a file using the [`outputFile`](/config/outputfile) configuration option.
348
-
349
- :::code-group
350
- ```bash [CLI]
351
- npx vitest --reporter=json
352
- ```
353
-
354
- ```ts [vitest.config.ts]
355
- export default defineConfig({
356
- test: {
357
- reporters: ['json']
358
- },
359
- })
360
- ```
361
- :::
362
-
363
- Example of a JSON report:
364
-
365
- ```json
366
- {
367
- "numTotalTestSuites": 4,
368
- "numPassedTestSuites": 2,
369
- "numFailedTestSuites": 1,
370
- "numPendingTestSuites": 1,
371
- "numTotalTests": 4,
372
- "numPassedTests": 1,
373
- "numFailedTests": 1,
374
- "numPendingTests": 1,
375
- "numTodoTests": 1,
376
- "startTime": 1697737019307,
377
- "success": false,
378
- "testResults": [
379
- {
380
- "assertionResults": [
381
- {
382
- "ancestorTitles": [
383
- "",
384
- "first test file"
385
- ],
386
- "fullName": " first test file 2 + 2 should equal 4",
387
- "status": "failed",
388
- "title": "2 + 2 should equal 4",
389
- "duration": 9,
390
- "failureMessages": [
391
- "expected 5 to be 4 // Object.is equality"
392
- ],
393
- "location": {
394
- "line": 20,
395
- "column": 28
396
- },
397
- "meta": {}
398
- }
399
- ],
400
- "startTime": 1697737019787,
401
- "endTime": 1697737019797,
402
- "status": "failed",
403
- "message": "",
404
- "name": "/root-directory/__tests__/test-file-1.test.ts"
405
- }
406
- ],
407
- "coverageMap": {}
408
- }
409
- ```
410
-
411
- ::: info
412
- Since Vitest 3, the JSON reporter includes coverage information in `coverageMap` if coverage is enabled.
413
- :::
414
-
415
- The `meta` field in each assertion result can be filtered via the `filterMeta` reporter option. It receives the key and value of each field and should return a falsy value to exclude the field from the report:
416
-
417
- ```ts
418
- export default defineConfig({
419
- test: {
420
- reporters: [
421
- ['json', {
422
- filterMeta: (key, value) => key !== 'internalField',
423
- }]
424
- ]
425
- },
426
- })
427
- ```
428
-
429
- ### HTML Reporter
430
-
431
- Generates an HTML file to view test results through an interactive [GUI](/guide/ui). After the file has been generated, Vitest will keep a local development server running and provide a link to view the report in a browser.
432
-
433
- Output file can be specified using the [`outputFile`](/config/outputfile) configuration option. If no `outputFile` option is provided, a new HTML file will be created.
434
-
435
- :::code-group
436
- ```bash [CLI]
437
- npx vitest --reporter=html
438
- ```
439
-
440
- ```ts [vitest.config.ts]
441
- export default defineConfig({
442
- test: {
443
- reporters: ['html']
444
- },
445
- })
446
- ```
447
- :::
448
-
449
- ::: tip
450
- This reporter requires installed [`@vitest/ui`](/guide/ui) package.
451
- :::
452
-
453
- ### TAP Reporter
454
-
455
- Outputs a report following [Test Anything Protocol](https://testanything.org/) (TAP).
456
-
457
- :::code-group
458
- ```bash [CLI]
459
- npx vitest --reporter=tap
460
- ```
461
-
462
- ```ts [vitest.config.ts]
463
- export default defineConfig({
464
- test: {
465
- reporters: ['tap']
466
- },
467
- })
468
- ```
469
- :::
470
-
471
- Example of a TAP report:
472
- ```bash
473
- TAP version 13
474
- 1..1
475
- not ok 1 - __tests__/test-file-1.test.ts # time=14.00ms {
476
- 1..1
477
- not ok 1 - first test file # time=13.00ms {
478
- 1..2
479
- not ok 1 - 2 + 2 should equal 4 # time=11.00ms
480
- ---
481
- error:
482
- name: "AssertionError"
483
- message: "expected 5 to be 4 // Object.is equality"
484
- at: "/root-directory/__tests__/test-file-1.test.ts:20:28"
485
- actual: "5"
486
- expected: "4"
487
- ...
488
- ok 2 - 4 - 2 should equal 2 # time=1.00ms
489
- }
490
- }
491
- ```
492
-
493
- ### TAP Flat Reporter
494
-
495
- Outputs a TAP flat report. Like the `tap` reporter, test results are formatted to follow TAP standards, but test suites are formatted as a flat list rather than a nested hierarchy.
496
-
497
- :::code-group
498
- ```bash [CLI]
499
- npx vitest --reporter=tap-flat
500
- ```
501
-
502
- ```ts [vitest.config.ts]
503
- export default defineConfig({
504
- test: {
505
- reporters: ['tap-flat']
506
- },
507
- })
508
- ```
509
- :::
510
-
511
- Example of a TAP flat report:
512
- ```bash
513
- TAP version 13
514
- 1..2
515
- not ok 1 - __tests__/test-file-1.test.ts > first test file > 2 + 2 should equal 4 # time=11.00ms
516
- ---
517
- error:
518
- name: "AssertionError"
519
- message: "expected 5 to be 4 // Object.is equality"
520
- at: "/root-directory/__tests__/test-file-1.test.ts:20:28"
521
- actual: "5"
522
- expected: "4"
523
- ...
524
- ok 2 - __tests__/test-file-1.test.ts > first test file > 4 - 2 should equal 2 # time=0.00ms
525
- ```
526
-
527
- ### Hanging Process Reporter
528
-
529
- Displays a list of hanging processes, if any are preventing Vitest from exiting safely. The `hanging-process` reporter does not itself display test results, but can be used in conjunction with another reporter to monitor processes while tests run. Using this reporter can be resource-intensive, so should generally be reserved for debugging purposes in situations where Vitest consistently cannot exit the process.
530
-
531
- :::code-group
532
- ```bash [CLI]
533
- npx vitest --reporter=hanging-process
534
- ```
535
-
536
- ```ts [vitest.config.ts]
537
- export default defineConfig({
538
- test: {
539
- reporters: ['hanging-process']
540
- },
541
- })
542
- ```
543
- :::
544
-
545
- ### GitHub Actions Reporter {#github-actions-reporter}
546
-
547
- Output [workflow commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message)
548
- 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).
549
-
550
- <img alt="GitHub Actions" img-dark src="https://github.com/vitest-dev/vitest/assets/4232207/336cddc2-df6b-4b8a-8e72-4d00010e37f5">
551
- <img alt="GitHub Actions" img-light src="https://github.com/vitest-dev/vitest/assets/4232207/ce8447c1-0eab-4fe1-abef-d0d322290dca">
552
-
553
- If you configure reporters, you need to explicitly add `github-actions`.
554
-
555
- ```ts
556
- export default defineConfig({
557
- test: {
558
- reporters: process.env.GITHUB_ACTIONS === 'true' ? ['dot', 'github-actions'] : ['dot'],
559
- },
560
- })
561
- ```
562
-
563
- 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.
564
-
565
- ```ts
566
- export default defineConfig({
567
- test: {
568
- reporters: process.env.GITHUB_ACTIONS === 'true'
569
- ? [
570
- 'default',
571
- ['github-actions', { onWritePath(path) {
572
- return path.replace(/^\/app\//, `${process.env.GITHUB_WORKSPACE}/`)
573
- } }],
574
- ]
575
- : ['default'],
576
- },
577
- })
578
- ```
579
-
580
- If you are using [Annotations API](/guide/test-annotations), the reporter will automatically inline them in the GitHub UI. You can disable this by setting `displayAnnotations` option to `false`:
581
-
582
- ```ts
583
- export default defineConfig({
584
- test: {
585
- reporters: [
586
- ['github-actions', { displayAnnotations: false }],
587
- ],
588
- },
589
- })
590
- ```
591
-
592
- The GitHub Actions reporter automatically generates a [Job Summary](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/) with an overview of your test results. The summary includes test file and test case statistics, and highlights flaky tests that required retries.
593
-
594
- <img alt="GitHub Actions Job Summary" img-dark src="/github-actions-job-summary-dark.png">
595
- <img alt="GitHub Actions Job Summary" img-light src="/github-actions-job-summary-light.png">
596
-
597
- The job summary is enabled by default and writes to the path specified by `$GITHUB_STEP_SUMMARY`. You can override it by using the `jobSummary.outputPath` option:
598
-
599
- ```ts
600
- export default defineConfig({
601
- test: {
602
- reporters: [
603
- ['github-actions', {
604
- jobSummary: {
605
- outputPath: '/home/runner/jobs/summary/step',
606
- },
607
- }],
608
- ],
609
- },
610
- })
611
- ```
612
-
613
- To disable the job summary:
614
-
615
- ```ts
616
- export default defineConfig({
617
- test: {
618
- reporters: [
619
- ['github-actions', { jobSummary: { enabled: false } }],
620
- ],
621
- },
622
- })
623
- ```
624
-
625
- The flaky tests section of the summary includes permalink URLs that link test names directly to the relevant source lines on GitHub. These links are generated automatically using environment variables that GitHub Actions provides (`$GITHUB_REPOSITORY`, `$GITHUB_SHA`, and `$GITHUB_WORKSPACE`), so no configuration is needed in most cases.
626
-
627
- If you need to override these values — for example, when running in a container or a custom environment — you can customize them via the `fileLinks` option:
628
-
629
- - `repository`: the GitHub repository in `owner/repo` format. Defaults to `process.env.GITHUB_REPOSITORY`.
630
- - `commitHash`: the commit SHA to use in permalink URLs. Defaults to `process.env.GITHUB_SHA`.
631
- - `workspacePath`: the absolute path to the root of the repository on disk. Used to compute relative file paths for the permalink URLs. Defaults to `process.env.GITHUB_WORKSPACE`.
632
-
633
- All three values must be available for the links to be generated.
634
-
635
- ```ts
636
- export default defineConfig({
637
- test: {
638
- reporters: [
639
- ['github-actions', {
640
- jobSummary: {
641
- fileLinks: {
642
- repository: 'owner/repo',
643
- commitHash: 'abcdefg',
644
- workspacePath: '/home/runner/work/repo/',
645
- },
646
- },
647
- }],
648
- ],
649
- },
650
- })
651
- ```
652
-
653
- ### Minimal Reporter
654
-
655
- - **Alias:** `agent`
656
-
657
- Outputs a minimal report containing only failed tests and their error messages. Console logs from passing tests and the summary section are also suppressed.
658
-
659
- ::: tip Agent Reporter
660
- 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`:
661
-
662
- :::code-group
663
- ```bash [CLI]
664
- npx vitest --reporter=minimal
665
- ```
666
-
667
- ```ts [vitest.config.ts]
668
- export default defineConfig({
669
- test: {
670
- reporters: ['minimal']
671
- },
672
- })
673
- ```
674
- :::
675
-
676
- ### Blob Reporter
677
-
678
- Stores test results on the machine so they can be later merged using [`--merge-reports`](/guide/cli#merge-reports) command.
679
- By default, stores all results in `.vitest-reports` folder, but can be overridden with `--outputFile` or `--outputFile.blob` flags.
680
-
681
- ```bash
682
- npx vitest --reporter=blob --outputFile=reports/blob-1.json
683
- ```
684
-
685
- We recommend using this reporter if you are running Vitest on different machines with the [`--shard`](/guide/cli#shard) flag.
686
- All blob reports can be merged into any report by using `--merge-reports` command at the end of your CI pipeline:
687
-
688
- ```bash
689
- npx vitest --merge-reports=reports --reporter=json --reporter=default
690
- ```
691
-
692
- Blob reporter output doesn't include file-based [attachments](/api/advanced/artifacts.html#testattachment).
693
- Make sure to merge [`attachmentsDir`](/config/attachmentsdir) separately alongside blob reports on CI when using this feature.
694
-
695
- ::: tip
696
- Both `--reporter=blob` and `--merge-reports` do not work in watch mode.
697
- :::
698
-
699
- ## Custom Reporters
700
-
701
- You can use third-party custom reporters installed from NPM by specifying their package name in the reporters' option:
702
-
703
- :::code-group
704
- ```bash [CLI]
705
- npx vitest --reporter=some-published-vitest-reporter
706
- ```
707
-
708
- ```ts [vitest.config.ts]
709
- export default defineConfig({
710
- test: {
711
- reporters: ['some-published-vitest-reporter']
712
- },
713
- })
714
- ```
715
- :::
716
-
717
- Additionally, you can define your own [custom reporters](/guide/advanced/reporters) and use them by specifying their file path:
718
-
719
- ```bash
720
- npx vitest --reporter=./path/to/reporter.ts
721
- ```
722
-
723
- Custom reporters should implement the [Reporter interface](https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/types/reporter.ts).