@vitest-agent/mcp 1.0.1 → 1.2.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 (229) hide show
  1. package/README.md +1 -2
  2. package/bin/vitest-agent-mcp.js +1 -17
  3. package/index.d.ts +324 -315
  4. package/index.js +2 -4
  5. package/middleware/idempotency.js +1 -1
  6. package/package.json +2 -2
  7. package/server.js +2 -4
  8. package/tools/acceptance-metrics.js +1 -1
  9. package/tools/cache-health.js +1 -1
  10. package/tools/commit-changes.js +1 -1
  11. package/tools/configure.js +1 -1
  12. package/tools/coverage.js +1 -1
  13. package/tools/errors.js +1 -1
  14. package/tools/failure-signature-get.js +1 -1
  15. package/tools/file-coverage.js +1 -1
  16. package/tools/history.js +1 -1
  17. package/tools/inventory.js +1 -1
  18. package/tools/overview.js +1 -1
  19. package/tools/run-tests.js +15 -3
  20. package/tools/settings-list.js +1 -1
  21. package/tools/status.js +1 -1
  22. package/tools/tdd-artifact.js +1 -1
  23. package/tools/tdd-task.js +1 -1
  24. package/tools/test.js +1 -1
  25. package/tools/trends.js +1 -1
  26. package/tools/turn-search.js +1 -1
  27. package/public/patterns/_meta.json +0 -67
  28. package/public/patterns/authoring-a-custom-vitest-agent-reporter.md +0 -82
  29. package/public/patterns/known-issues-and-caveats.md +0 -52
  30. package/public/patterns/operating-vitest-agent-as-an-agent.md +0 -53
  31. package/public/patterns/running-tests-via-mcp.md +0 -58
  32. package/public/patterns/silencing-leaking-output-in-tests.md +0 -91
  33. package/public/patterns/testing-effect-schema-definitions.md +0 -71
  34. package/public/patterns/testing-effect-services-with-mock-layers.md +0 -63
  35. package/public/vendor/vitest-docs/ATTRIBUTION.md +0 -5
  36. package/public/vendor/vitest-docs/api/advanced/artifacts.md +0 -189
  37. package/public/vendor/vitest-docs/api/advanced/metadata.md +0 -68
  38. package/public/vendor/vitest-docs/api/advanced/plugin.md +0 -168
  39. package/public/vendor/vitest-docs/api/advanced/reporters.md +0 -342
  40. package/public/vendor/vitest-docs/api/advanced/runner.md +0 -334
  41. package/public/vendor/vitest-docs/api/advanced/test-case.md +0 -302
  42. package/public/vendor/vitest-docs/api/advanced/test-collection.md +0 -89
  43. package/public/vendor/vitest-docs/api/advanced/test-module.md +0 -140
  44. package/public/vendor/vitest-docs/api/advanced/test-project.md +0 -321
  45. package/public/vendor/vitest-docs/api/advanced/test-specification.md +0 -96
  46. package/public/vendor/vitest-docs/api/advanced/test-suite.md +0 -230
  47. package/public/vendor/vitest-docs/api/advanced/vitest.md +0 -684
  48. package/public/vendor/vitest-docs/api/assert-type.md +0 -22
  49. package/public/vendor/vitest-docs/api/assert.md +0 -1960
  50. package/public/vendor/vitest-docs/api/browser/assertions.md +0 -1277
  51. package/public/vendor/vitest-docs/api/browser/commands.md +0 -154
  52. package/public/vendor/vitest-docs/api/browser/context.md +0 -338
  53. package/public/vendor/vitest-docs/api/browser/interactivity.md +0 -681
  54. package/public/vendor/vitest-docs/api/browser/locators.md +0 -1171
  55. package/public/vendor/vitest-docs/api/browser/react.md +0 -346
  56. package/public/vendor/vitest-docs/api/browser/svelte.md +0 -292
  57. package/public/vendor/vitest-docs/api/browser/vue.md +0 -222
  58. package/public/vendor/vitest-docs/api/describe.md +0 -374
  59. package/public/vendor/vitest-docs/api/expect-typeof.md +0 -571
  60. package/public/vendor/vitest-docs/api/expect.md +0 -2304
  61. package/public/vendor/vitest-docs/api/hooks.md +0 -463
  62. package/public/vendor/vitest-docs/api/mock.md +0 -701
  63. package/public/vendor/vitest-docs/api/test.md +0 -926
  64. package/public/vendor/vitest-docs/api/vi.md +0 -1372
  65. package/public/vendor/vitest-docs/config/alias.md +0 -13
  66. package/public/vendor/vitest-docs/config/allowonly.md +0 -32
  67. package/public/vendor/vitest-docs/config/api.md +0 -27
  68. package/public/vendor/vitest-docs/config/attachmentsdir.md +0 -6
  69. package/public/vendor/vitest-docs/config/bail.md +0 -9
  70. package/public/vendor/vitest-docs/config/benchmark.md +0 -65
  71. package/public/vendor/vitest-docs/config/browser/api.md +0 -23
  72. package/public/vendor/vitest-docs/config/browser/commands.md +0 -6
  73. package/public/vendor/vitest-docs/config/browser/connecttimeout.md +0 -10
  74. package/public/vendor/vitest-docs/config/browser/detailspanelposition.md +0 -38
  75. package/public/vendor/vitest-docs/config/browser/enabled.md +0 -40
  76. package/public/vendor/vitest-docs/config/browser/expect.md +0 -250
  77. package/public/vendor/vitest-docs/config/browser/headless.md +0 -7
  78. package/public/vendor/vitest-docs/config/browser/instances.md +0 -47
  79. package/public/vendor/vitest-docs/config/browser/isolate.md +0 -11
  80. package/public/vendor/vitest-docs/config/browser/locators.md +0 -24
  81. package/public/vendor/vitest-docs/config/browser/orchestratorscripts.md +0 -39
  82. package/public/vendor/vitest-docs/config/browser/playwright.md +0 -214
  83. package/public/vendor/vitest-docs/config/browser/preview.md +0 -32
  84. package/public/vendor/vitest-docs/config/browser/provider.md +0 -79
  85. package/public/vendor/vitest-docs/config/browser/screenshotdirectory.md +0 -6
  86. package/public/vendor/vitest-docs/config/browser/screenshotfailures.md +0 -6
  87. package/public/vendor/vitest-docs/config/browser/testerhtmlpath.md +0 -5
  88. package/public/vendor/vitest-docs/config/browser/trace.md +0 -43
  89. package/public/vendor/vitest-docs/config/browser/trackunhandlederrors.md +0 -10
  90. package/public/vendor/vitest-docs/config/browser/ui.md +0 -7
  91. package/public/vendor/vitest-docs/config/browser/viewport.md +0 -6
  92. package/public/vendor/vitest-docs/config/browser/webdriverio.md +0 -64
  93. package/public/vendor/vitest-docs/config/cache.md +0 -26
  94. package/public/vendor/vitest-docs/config/chaiconfig.md +0 -29
  95. package/public/vendor/vitest-docs/config/clearmocks.md +0 -22
  96. package/public/vendor/vitest-docs/config/coverage.md +0 -455
  97. package/public/vendor/vitest-docs/config/css.md +0 -47
  98. package/public/vendor/vitest-docs/config/dangerouslyignoreunhandlederrors.md +0 -23
  99. package/public/vendor/vitest-docs/config/deps.md +0 -127
  100. package/public/vendor/vitest-docs/config/detectasyncleaks.md +0 -39
  101. package/public/vendor/vitest-docs/config/diff.md +0 -96
  102. package/public/vendor/vitest-docs/config/dir.md +0 -7
  103. package/public/vendor/vitest-docs/config/disableconsoleintercept.md +0 -15
  104. package/public/vendor/vitest-docs/config/env.md +0 -5
  105. package/public/vendor/vitest-docs/config/environment.md +0 -96
  106. package/public/vendor/vitest-docs/config/environmentoptions.md +0 -30
  107. package/public/vendor/vitest-docs/config/exclude.md +0 -49
  108. package/public/vendor/vitest-docs/config/execargv.md +0 -10
  109. package/public/vendor/vitest-docs/config/expandsnapshotdiff.md +0 -7
  110. package/public/vendor/vitest-docs/config/expect.md +0 -38
  111. package/public/vendor/vitest-docs/config/experimental.md +0 -510
  112. package/public/vendor/vitest-docs/config/faketimers.md +0 -51
  113. package/public/vendor/vitest-docs/config/fileparallelism.md +0 -11
  114. package/public/vendor/vitest-docs/config/forcereruntriggers.md +0 -19
  115. package/public/vendor/vitest-docs/config/globals.md +0 -42
  116. package/public/vendor/vitest-docs/config/globalsetup.md +0 -72
  117. package/public/vendor/vitest-docs/config/hideskippedtests.md +0 -7
  118. package/public/vendor/vitest-docs/config/hooktimeout.md +0 -7
  119. package/public/vendor/vitest-docs/config/include-source.md +0 -115
  120. package/public/vendor/vitest-docs/config/include.md +0 -71
  121. package/public/vendor/vitest-docs/config/includetasklocation.md +0 -17
  122. package/public/vendor/vitest-docs/config/index.md +0 -85
  123. package/public/vendor/vitest-docs/config/isolate.md +0 -13
  124. package/public/vendor/vitest-docs/config/logheapusage.md +0 -7
  125. package/public/vendor/vitest-docs/config/maxconcurrency.md +0 -9
  126. package/public/vendor/vitest-docs/config/maxworkers.md +0 -49
  127. package/public/vendor/vitest-docs/config/mockreset.md +0 -22
  128. package/public/vendor/vitest-docs/config/mode.md +0 -7
  129. package/public/vendor/vitest-docs/config/name.md +0 -111
  130. package/public/vendor/vitest-docs/config/onconsolelog.md +0 -25
  131. package/public/vendor/vitest-docs/config/onstacktrace.md +0 -32
  132. package/public/vendor/vitest-docs/config/onunhandlederror.md +0 -35
  133. package/public/vendor/vitest-docs/config/open.md +0 -7
  134. package/public/vendor/vitest-docs/config/outputfile.md +0 -7
  135. package/public/vendor/vitest-docs/config/passwithnotests.md +0 -7
  136. package/public/vendor/vitest-docs/config/pool.md +0 -45
  137. package/public/vendor/vitest-docs/config/printconsoletrace.md +0 -6
  138. package/public/vendor/vitest-docs/config/projects.md +0 -6
  139. package/public/vendor/vitest-docs/config/provide.md +0 -45
  140. package/public/vendor/vitest-docs/config/reporters.md +0 -69
  141. package/public/vendor/vitest-docs/config/resolvesnapshotpath.md +0 -36
  142. package/public/vendor/vitest-docs/config/restoremocks.md +0 -22
  143. package/public/vendor/vitest-docs/config/retry.md +0 -140
  144. package/public/vendor/vitest-docs/config/root.md +0 -6
  145. package/public/vendor/vitest-docs/config/runner.md +0 -6
  146. package/public/vendor/vitest-docs/config/sequence.md +0 -158
  147. package/public/vendor/vitest-docs/config/server.md +0 -68
  148. package/public/vendor/vitest-docs/config/setupfiles.md +0 -40
  149. package/public/vendor/vitest-docs/config/silent.md +0 -9
  150. package/public/vendor/vitest-docs/config/slowtestthreshold.md +0 -7
  151. package/public/vendor/vitest-docs/config/snapshotenvironment.md +0 -27
  152. package/public/vendor/vitest-docs/config/snapshotformat.md +0 -28
  153. package/public/vendor/vitest-docs/config/snapshotserializers.md +0 -6
  154. package/public/vendor/vitest-docs/config/stricttags.md +0 -30
  155. package/public/vendor/vitest-docs/config/tags.md +0 -141
  156. package/public/vendor/vitest-docs/config/teardowntimeout.md +0 -7
  157. package/public/vendor/vitest-docs/config/testnamepattern.md +0 -21
  158. package/public/vendor/vitest-docs/config/testtimeout.md +0 -7
  159. package/public/vendor/vitest-docs/config/typecheck.md +0 -77
  160. package/public/vendor/vitest-docs/config/ui.md +0 -15
  161. package/public/vendor/vitest-docs/config/unstubenvs.md +0 -20
  162. package/public/vendor/vitest-docs/config/unstubglobals.md +0 -20
  163. package/public/vendor/vitest-docs/config/update.md +0 -16
  164. package/public/vendor/vitest-docs/config/vmmemorylimit.md +0 -30
  165. package/public/vendor/vitest-docs/config/watch.md +0 -11
  166. package/public/vendor/vitest-docs/config/watchtriggerpatterns.md +0 -29
  167. package/public/vendor/vitest-docs/guide/advanced/index.md +0 -147
  168. package/public/vendor/vitest-docs/guide/advanced/pool.md +0 -148
  169. package/public/vendor/vitest-docs/guide/advanced/reporters.md +0 -93
  170. package/public/vendor/vitest-docs/guide/advanced/tests.md +0 -125
  171. package/public/vendor/vitest-docs/guide/browser/aria-snapshots.md +0 -470
  172. package/public/vendor/vitest-docs/guide/browser/component-testing.md +0 -571
  173. package/public/vendor/vitest-docs/guide/browser/index.md +0 -630
  174. package/public/vendor/vitest-docs/guide/browser/multiple-setups.md +0 -121
  175. package/public/vendor/vitest-docs/guide/browser/trace-view.md +0 -126
  176. package/public/vendor/vitest-docs/guide/browser/visual-regression-testing.md +0 -734
  177. package/public/vendor/vitest-docs/guide/cli-generated.md +0 -972
  178. package/public/vendor/vitest-docs/guide/cli.md +0 -234
  179. package/public/vendor/vitest-docs/guide/common-errors.md +0 -163
  180. package/public/vendor/vitest-docs/guide/coverage.md +0 -515
  181. package/public/vendor/vitest-docs/guide/debugging.md +0 -127
  182. package/public/vendor/vitest-docs/guide/environment.md +0 -101
  183. package/public/vendor/vitest-docs/guide/extending-matchers.md +0 -160
  184. package/public/vendor/vitest-docs/guide/features.md +0 -310
  185. package/public/vendor/vitest-docs/guide/filtering.md +0 -175
  186. package/public/vendor/vitest-docs/guide/ide.md +0 -43
  187. package/public/vendor/vitest-docs/guide/improving-performance.md +0 -245
  188. package/public/vendor/vitest-docs/guide/in-source.md +0 -159
  189. package/public/vendor/vitest-docs/guide/index.md +0 -128
  190. package/public/vendor/vitest-docs/guide/learn/async.md +0 -147
  191. package/public/vendor/vitest-docs/guide/learn/debugging-tests.md +0 -210
  192. package/public/vendor/vitest-docs/guide/learn/matchers.md +0 -277
  193. package/public/vendor/vitest-docs/guide/learn/mock-functions.md +0 -277
  194. package/public/vendor/vitest-docs/guide/learn/setup-teardown.md +0 -240
  195. package/public/vendor/vitest-docs/guide/learn/snapshots.md +0 -166
  196. package/public/vendor/vitest-docs/guide/learn/testing-in-practice.md +0 -430
  197. package/public/vendor/vitest-docs/guide/learn/writing-tests-with-ai.md +0 -127
  198. package/public/vendor/vitest-docs/guide/learn/writing-tests.md +0 -231
  199. package/public/vendor/vitest-docs/guide/lifecycle.md +0 -379
  200. package/public/vendor/vitest-docs/guide/migration.md +0 -863
  201. package/public/vendor/vitest-docs/guide/mocking/classes.md +0 -158
  202. package/public/vendor/vitest-docs/guide/mocking/dates.md +0 -52
  203. package/public/vendor/vitest-docs/guide/mocking/file-system.md +0 -74
  204. package/public/vendor/vitest-docs/guide/mocking/functions.md +0 -61
  205. package/public/vendor/vitest-docs/guide/mocking/globals.md +0 -20
  206. package/public/vendor/vitest-docs/guide/mocking/modules.md +0 -414
  207. package/public/vendor/vitest-docs/guide/mocking/requests.md +0 -114
  208. package/public/vendor/vitest-docs/guide/mocking/timers.md +0 -48
  209. package/public/vendor/vitest-docs/guide/mocking.md +0 -239
  210. package/public/vendor/vitest-docs/guide/open-telemetry.md +0 -156
  211. package/public/vendor/vitest-docs/guide/parallelism.md +0 -82
  212. package/public/vendor/vitest-docs/guide/profiling-test-performance.md +0 -243
  213. package/public/vendor/vitest-docs/guide/projects.md +0 -291
  214. package/public/vendor/vitest-docs/guide/recipes.md +0 -59
  215. package/public/vendor/vitest-docs/guide/reporters.md +0 -723
  216. package/public/vendor/vitest-docs/guide/snapshot.md +0 -620
  217. package/public/vendor/vitest-docs/guide/test-annotations.md +0 -103
  218. package/public/vendor/vitest-docs/guide/test-context.md +0 -902
  219. package/public/vendor/vitest-docs/guide/test-tags.md +0 -314
  220. package/public/vendor/vitest-docs/guide/testing-types.md +0 -149
  221. package/public/vendor/vitest-docs/guide/ui.md +0 -160
  222. package/public/vendor/vitest-docs/guide/using-plugins.md +0 -5
  223. package/public/vendor/vitest-docs/manifest.json +0 -1691
  224. package/resources/index.js +0 -166
  225. package/resources/indexes.js +0 -77
  226. package/resources/manifest-schema.js +0 -46
  227. package/resources/paths.js +0 -20
  228. package/resources/patterns.js +0 -22
  229. package/resources/upstream-docs.js +0 -22
@@ -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).