@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,40 +0,0 @@
1
- # setupFiles
2
-
3
- - **Type:** `string | string[]`
4
-
5
- Paths to setup files resolved relative to the [`root`](/config/root). They will run before each _test file_ in the same process. By default, all test files run in parallel, but you can configure it with [`sequence.setupFiles`](/config/sequence#sequence-setupfiles) option.
6
-
7
- Vitest will ignore any exports from these files.
8
-
9
- :::warning
10
- Note that setup files are executed in the same process as tests, unlike [`globalSetup`](/config/globalsetup) that runs once in the main thread before any test worker is created.
11
- :::
12
-
13
- :::info
14
- Editing a setup file will automatically trigger a rerun of all tests.
15
- :::
16
-
17
- If you have a heavy process running in the background, you can use `process.env.VITEST_POOL_ID` (integer-like string) inside to distinguish between workers and spread the workload.
18
-
19
- :::warning
20
- If [isolation](/config/isolate) is disabled, imported modules are cached, but the setup file itself is executed again before each test file, meaning that you are accessing the same global object before each test file. Make sure you are not doing the same thing more than necessary.
21
-
22
- For example, you may rely on a global variable:
23
-
24
- ```ts
25
- import { config } from '@some-testing-lib'
26
-
27
- if (!globalThis.setupInitialized) {
28
- config.plugins = [myCoolPlugin]
29
- computeHeavyThing()
30
- globalThis.setupInitialized = true
31
- }
32
-
33
- // hooks reset before each test file
34
- afterEach(() => {
35
- cleanup()
36
- })
37
-
38
- globalThis.resetBeforeEachTest = true
39
- ```
40
- :::
@@ -1,9 +0,0 @@
1
- # silent <CRoot /> {#silent}
2
-
3
- - **Type:** `boolean | 'passed-only'`
4
- - **Default:** `false`
5
- - **CLI:** `--silent`, `--silent=false`
6
-
7
- Silent console output from tests.
8
-
9
- Use `'passed-only'` to see logs from failing tests only. Logs from failing tests are printed after a test has finished.
@@ -1,7 +0,0 @@
1
- # slowTestThreshold <CRoot />
2
-
3
- - **Type:** `number`
4
- - **Default:** `300`
5
- - **CLI:** `--slow-test-threshold=<number>`, `--slowTestThreshold=<number>`
6
-
7
- The number of milliseconds after which a test or suite is considered slow and reported as such in the results.
@@ -1,27 +0,0 @@
1
- # snapshotEnvironment
2
-
3
- - **Type:** `string`
4
-
5
- Path to a custom snapshot environment implementation. This is useful if you are running your tests in an environment that doesn't support Node.js APIs. This option doesn't have any effect on a browser runner.
6
-
7
- This object should have the shape of `SnapshotEnvironment` and is used to resolve and read/write snapshot files:
8
-
9
- ```ts
10
- export interface SnapshotEnvironment {
11
- getVersion: () => string
12
- getHeader: () => string
13
- resolvePath: (filepath: string) => Promise<string>
14
- resolveRawPath: (testPath: string, rawPath: string) => Promise<string>
15
- saveSnapshotFile: (filepath: string, snapshot: string) => Promise<void>
16
- readSnapshotFile: (filepath: string) => Promise<string | null>
17
- removeSnapshotFile: (filepath: string) => Promise<void>
18
- }
19
- ```
20
-
21
- You can extend default `VitestSnapshotEnvironment` from `vitest/snapshot` entry point if you need to overwrite only a part of the API.
22
-
23
- ::: warning
24
- This is a low-level option and should be used only for advanced cases where you don't have access to default Node.js APIs.
25
-
26
- If you just need to configure snapshots feature, use [`snapshotFormat`](/config/snapshotformat) or [`resolveSnapshotPath`](/config/resolvesnapshotpath) options.
27
- :::
@@ -1,28 +0,0 @@
1
- # snapshotFormat <CRoot />
2
-
3
- - **Type:** `Omit<PrettyFormatOptions, 'plugins' | 'compareKeys'> & { compareKeys?: null | undefined }`
4
-
5
- Format options for snapshot testing. These options configure the snapshot-specific formatting layer built on top of [`@vitest/pretty-format`](https://npmx.dev/package/@vitest/pretty-format).
6
-
7
- For the full option surface of `PrettyFormatOptions`, see [`@vitest/pretty-format`](https://npmx.dev/package/@vitest/pretty-format). This page focuses on the Vitest snapshot-specific defaults and constraints.
8
-
9
- Vitest snapshots already apply these defaults before your `snapshotFormat` overrides:
10
-
11
- - `printBasicPrototype: false`
12
- - `escapeString: false`
13
- - `escapeRegex: true`
14
- - `printFunctionName: false`
15
-
16
- Vitest also supports formatter options such as `printShadowRoot` and `maxOutputLength` in `snapshotFormat`.
17
-
18
- `printShadowRoot` controls whether shadow-root contents are included in DOM snapshots.
19
-
20
- `maxOutputLength` is an approximate per-depth output budget, not a hard cap on the final rendered string.
21
-
22
- By default, snapshot keys are sorted using the formatter's default behavior. Set `compareKeys` to `null` to disable key sorting. Custom compare functions are not supported in `snapshotFormat`.
23
-
24
- ::: tip
25
- Beware that `plugins` on this object will be ignored.
26
-
27
- If you need to extend snapshot serialization via pretty-format plugins, use [`expect.addSnapshotSerializer`](/api/expect#expect-addsnapshotserializer) or [`snapshotSerializers`](/config/snapshotserializers) instead.
28
- :::
@@ -1,6 +0,0 @@
1
- # snapshotSerializers <CRoot />
2
-
3
- - **Type:** `string[]`
4
- - **Default:** `[]`
5
-
6
- A list of paths to snapshot serializer modules for snapshot testing, useful if you want add custom snapshot serializers. See [Custom Serializer](/guide/snapshot#custom-serializer) for more information.
@@ -1,30 +0,0 @@
1
- # strictTags <Version>4.1.0</Version> {#stricttags}
2
-
3
- - **Type:** `boolean`
4
- - **Default:** `true`
5
- - **CLI:** `--strict-tags`, `--no-strict-tags`
6
-
7
- Should Vitest throw an error if test has a [`tag`](/config/tags) that is not defined in the config to avoid silently doing something surprising due to mistyped names (applying the wrong configuration or skipping the test due to a `--tags-filter` flag).
8
-
9
- Note that Vitest will always throw an error if `--tags-filter` flag defines a tag not present in the config.
10
-
11
- For example, this test will throw an error because the tag `fortnend` has a typo (it should be `frontend`):
12
-
13
- ::: code-group
14
- ```js [form.test.js]
15
- test('renders a form', { tags: ['fortnend'] }, () => {
16
- // ...
17
- })
18
- ```
19
- ```js [vitest.config.js]
20
- import { defineConfig } from 'vitest/config'
21
-
22
- export default defineConfig({
23
- test: {
24
- tags: [
25
- { name: 'frontend' },
26
- ],
27
- },
28
- })
29
- ```
30
- :::
@@ -1,141 +0,0 @@
1
- # tags <Version>4.1.0</Version> {#tags}
2
-
3
- - **Type:** `TestTagDefinition[]`
4
- - **Default:** `[]`
5
-
6
- Defines all [available tags](/guide/test-tags) in your test project. By default, if test defines a name not listed here, Vitest will throw an error, but this can be configured via a [`strictTags`](/config/stricttags) option.
7
-
8
- If you are using [`projects`](/config/projects), they will inherit all global tags definitions automatically.
9
-
10
- Use [`--tags-filter`](/guide/test-tags#syntax) to filter tests by their tags. Use [`--list-tags`](/guide/cli#listtags) to print every tag in your Vitest workspace.
11
-
12
- ## name
13
-
14
- - **Type:** `string`
15
- - **Required:** `true`
16
-
17
- The name of the tag. This is what you use in the `tags` option in tests.
18
-
19
- ```ts
20
- export default defineConfig({
21
- test: {
22
- tags: [
23
- { name: 'unit' },
24
- { name: 'e2e' },
25
- ],
26
- },
27
- })
28
- ```
29
-
30
- ::: tip
31
- If you are using TypeScript, you can enforce what tags are available by augmenting the `TestTags` type with a property that contains a union of strings (make sure this file is included by your `tsconfig`):
32
-
33
- ```ts [vitest.shims.ts]
34
- import 'vitest'
35
-
36
- declare module 'vitest' {
37
- interface TestTags {
38
- tags:
39
- | 'frontend'
40
- | 'backend'
41
- | 'db'
42
- | 'flaky'
43
- }
44
- }
45
- ```
46
- :::
47
-
48
- ## description
49
-
50
- - **Type:** `string`
51
-
52
- A human-readable description for the tag. This will be shown in UI and inside error messages when a tag is not found.
53
-
54
- ```ts
55
- export default defineConfig({
56
- test: {
57
- tags: [
58
- {
59
- name: 'slow',
60
- description: 'Tests that take a long time to run.',
61
- },
62
- ],
63
- },
64
- })
65
- ```
66
-
67
- ## priority
68
-
69
- - **Type:** `number`
70
- - **Default:** `Infinity`
71
-
72
- Priority for merging options when multiple tags with the same options are applied to a test. Lower number means higher priority (e.g., priority `1` takes precedence over priority `3`).
73
-
74
- ```ts
75
- export default defineConfig({
76
- test: {
77
- tags: [
78
- {
79
- name: 'flaky',
80
- timeout: 30_000,
81
- priority: 1, // higher priority
82
- },
83
- {
84
- name: 'db',
85
- timeout: 60_000,
86
- priority: 2, // lower priority
87
- },
88
- ],
89
- },
90
- })
91
- ```
92
-
93
- When a test has both tags, the `timeout` will be `30_000` because `flaky` has a higher priority.
94
-
95
- ## Test Options
96
-
97
- Tags can define [test options](/api/test#test-options) that will be applied to every test marked with the tag. These options are merged with the test's own options, with the test's options taking precedence.
98
-
99
- ::: warning
100
- The [`retry.condition`](/api/test#retry) can only be a regexp because the config values need to be serialised.
101
-
102
- Tags also cannot apply other [tags](/api/test#tags) via these options.
103
- :::
104
-
105
- ## Example
106
-
107
- ```ts
108
- import { defineConfig } from 'vitest/config'
109
-
110
- export default defineConfig({
111
- test: {
112
- tags: [
113
- {
114
- name: 'unit',
115
- description: 'Unit tests.',
116
- },
117
- {
118
- name: 'e2e',
119
- description: 'End-to-end tests.',
120
- timeout: 60_000,
121
- },
122
- {
123
- name: 'flaky',
124
- description: 'Flaky tests that need retries.',
125
- retry: process.env.CI ? 3 : 0,
126
- priority: 1,
127
- },
128
- {
129
- name: 'slow',
130
- description: 'Slow tests.',
131
- timeout: 120_000,
132
- },
133
- {
134
- name: 'skip-ci',
135
- description: 'Tests to skip in CI.',
136
- skip: !!process.env.CI,
137
- },
138
- ],
139
- },
140
- })
141
- ```
@@ -1,7 +0,0 @@
1
- # teardownTimeout <CRoot /> {#teardowntimeout}
2
-
3
- - **Type:** `number`
4
- - **Default:** `10000`
5
- - **CLI:** `--teardown-timeout=5000`, `--teardownTimeout=5000`
6
-
7
- Default timeout to wait for close when Vitest shuts down, in milliseconds
@@ -1,21 +0,0 @@
1
- # testNamePattern <CRoot /> {#testnamepattern}
2
-
3
- - **Type:** `string | RegExp`
4
- - **CLI:** `-t <pattern>`, `--testNamePattern=<pattern>`, `--test-name-pattern=<pattern>`
5
-
6
- Run tests with full names matching the pattern.
7
- If you add `OnlyRunThis` to this property, tests not containing the word `OnlyRunThis` in the test name will be skipped.
8
-
9
- ```js
10
- import { expect, test } from 'vitest'
11
-
12
- // run
13
- test('OnlyRunThis', () => {
14
- expect(true).toBe(true)
15
- })
16
-
17
- // skipped
18
- test('doNotRun', () => {
19
- expect(true).toBe(true)
20
- })
21
- ```
@@ -1,7 +0,0 @@
1
- # testTimeout
2
-
3
- - **Type:** `number`
4
- - **Default:** `5_000` in Node.js, `15_000` if `browser.enabled` is `true`
5
- - **CLI:** `--test-timeout=5000`, `--testTimeout=5000`
6
-
7
- Default timeout of a test in milliseconds. Use `0` to disable timeout completely.
@@ -1,77 +0,0 @@
1
- # typecheck <Experimental /> {#typecheck}
2
-
3
- Options for configuring [typechecking](/guide/testing-types) test environment.
4
-
5
- ## typecheck.enabled {#typecheck-enabled}
6
-
7
- - **Type:** `boolean`
8
- - **Default:** `false`
9
- - **CLI:** `--typecheck`, `--typecheck.enabled`
10
-
11
- Enable typechecking alongside your regular tests.
12
-
13
- ## typecheck.only {#typecheck-only}
14
-
15
- - **Type:** `boolean`
16
- - **Default:** `false`
17
- - **CLI:** `--typecheck.only`
18
-
19
- Run only typecheck tests, when typechecking is enabled. When using CLI, this option will automatically enable typechecking.
20
-
21
- ## typecheck.checker
22
-
23
- - **Type:** `'tsc' | 'vue-tsc' | string`
24
- - **Default:** `tsc`
25
-
26
- What tools to use for type checking. Vitest will spawn a process with certain parameters for easier parsing, depending on the type. Checker should implement the same output format as `tsc`.
27
-
28
- You need to have a package installed to use typechecker:
29
-
30
- - `tsc` requires `typescript` package
31
- - `vue-tsc` requires `vue-tsc` package
32
-
33
- You can also pass down a path to custom binary or command name that produces the same output as `tsc --noEmit --pretty false`.
34
-
35
- ## typecheck.include
36
-
37
- - **Type:** `string[]`
38
- - **Default:** `['**/*.{test,spec}-d.?(c|m)[jt]s?(x)']`
39
-
40
- Glob pattern for files that should be treated as test files.
41
-
42
- ## typecheck.exclude
43
-
44
- - **Type:** `string[]`
45
- - **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**']`
46
-
47
- Glob pattern for files that should not be treated as test files.
48
-
49
- ## typecheck.allowJs
50
-
51
- - **Type:** `boolean`
52
- - **Default:** `false`
53
-
54
- Check JS files that have `@ts-check` comment. If you have it enabled in tsconfig, this will not overwrite it.
55
-
56
- ## typecheck.ignoreSourceErrors
57
-
58
- - **Type:** `boolean`
59
- - **Default:** `false`
60
-
61
- Do not fail, if Vitest found errors outside the test files. This will not show you non-test errors at all.
62
-
63
- By default, if Vitest finds source error, it will fail test suite.
64
-
65
- ## typecheck.tsconfig
66
-
67
- - **Type:** `string`
68
- - **Default:** _tries to find closest tsconfig.json_
69
-
70
- Path to custom tsconfig, relative to the project root.
71
-
72
- ## typecheck.spawnTimeout
73
-
74
- - **Type:** `number`
75
- - **Default:** `10_000`
76
-
77
- Minimum time in milliseconds it takes to spawn the typechecker.
@@ -1,15 +0,0 @@
1
- # ui <CRoot />
2
-
3
- - **Type:** `boolean`
4
- - **Default:** `false`
5
- - **CLI:** `--ui`, `--ui=false`
6
-
7
- Enable [Vitest UI](/guide/ui).
8
-
9
- ::: warning
10
- This features requires a [`@vitest/ui`](https://npmx.dev/package/@vitest/ui) package to be installed. If you do not have it already, Vitest will install it when you run the test command for the first time.
11
- :::
12
-
13
- ::: danger SECURITY ADVICE
14
- Make sure that your UI server is not exposed to the network. Since Vitest 4.1 setting [`api.host`](/config/api) to anything other than `localhost` will disable the buttons to save the code or run any tests for security reasons, effectively making UI a readonly reporter.
15
- :::
@@ -1,20 +0,0 @@
1
- # unstubEnvs
2
-
3
- - **Type:** `boolean`
4
- - **Default:** `false`
5
-
6
- Should Vitest automatically call [`vi.unstubAllEnvs()`](/api/vi#vi-unstuballenvs) before each test.
7
-
8
- ```js [vitest.config.js]
9
- import { defineConfig } from 'vitest/config'
10
-
11
- export default defineConfig({
12
- test: {
13
- unstubEnvs: true,
14
- },
15
- })
16
- ```
17
-
18
- ::: warning
19
- Be aware that this option may cause problems with async [concurrent tests](/api/test#test-concurrent). If enabled, the completion of one test will restore all the values changed with [`vi.stubEnv`](/api/vi#vi-stubenv), including those currently being used by other tests in progress.
20
- :::
@@ -1,20 +0,0 @@
1
- # unstubGlobals
2
-
3
- - **Type:** `boolean`
4
- - **Default:** `false`
5
-
6
- Should Vitest automatically call [`vi.unstubAllGlobals()`](/api/vi#vi-unstuballglobals) before each test.
7
-
8
- ```js [vitest.config.js]
9
- import { defineConfig } from 'vitest/config'
10
-
11
- export default defineConfig({
12
- test: {
13
- unstubGlobals: true,
14
- },
15
- })
16
- ```
17
-
18
- ::: warning
19
- Be aware that this option may cause problems with async [concurrent tests](/api/test#test-concurrent). If enabled, the completion of one test will restore all global values that were changed with [`vi.stubGlobal`](/api/vi#vi-stubglobal), including those currently being used by other tests in progress.
20
- :::
@@ -1,16 +0,0 @@
1
- # update <CRoot /> {#update}
2
-
3
- - **Type:** `boolean | 'new' | 'all' | 'none'`
4
- - **Default:** `false`
5
- - **CLI:** `-u`, `--update`, `--update=false`, `--update=new`, `--update=none`
6
-
7
- Define snapshot update behavior.
8
-
9
- - `true` or `'all'`: updates all changed snapshots and deletes obsolete ones
10
- - `new`: generates new snapshots without changing or deleting obsolete ones
11
- - `none`: does not write snapshots and fails on snapshot mismatches, missing snapshots, and obsolete snapshots
12
-
13
- When `update` is `false` (the default), Vitest resolves snapshot update mode by environment:
14
-
15
- - Local runs (non-CI): works same as `new`
16
- - CI runs (`process.env.CI` is truthy): works same as `none`
@@ -1,30 +0,0 @@
1
- # vmMemoryLimit
2
-
3
- - **Type:** `string | number`
4
- - **Default:** `1 / CPU Cores`
5
-
6
- This option affects only `vmForks` and `vmThreads` pools.
7
-
8
- Specifies the memory limit for workers before they are recycled. This value heavily depends on your environment, so it's better to specify it manually instead of relying on the default.
9
-
10
- ::: tip
11
- The implementation is based on Jest's [`workerIdleMemoryLimit`](https://jestjs.io/docs/configuration#workeridlememorylimit-numberstring).
12
-
13
- The limit can be specified in a number of different ways and whatever the result is `Math.floor` is used to turn it into an integer value:
14
-
15
- - `<= 1` - The value is assumed to be a percentage of system memory. So 0.5 sets the memory limit of the worker to half of the total system memory
16
- - `\> 1` - Assumed to be a fixed byte value. Because of the previous rule if you wanted a value of 1 byte (I don't know why) you could use 1.1.
17
- - With units
18
- - `50%` - As above, a percentage of total system memory
19
- - `100KB`, `65MB`, etc - With units to denote a fixed memory limit.
20
- - `K` / `KB` - Kilobytes (x1000)
21
- - `KiB` - Kibibytes (x1024)
22
- - `M` / `MB` - Megabytes
23
- - `MiB` - Mebibytes
24
- - `G` / `GB` - Gigabytes
25
- - `GiB` - Gibibytes
26
- :::
27
-
28
- ::: warning
29
- Percentage based memory limit [does not work on Linux CircleCI](https://github.com/jestjs/jest/issues/11956#issuecomment-1212925677) workers due to incorrect system memory being reported.
30
- :::
@@ -1,11 +0,0 @@
1
- # watch <CRoot /> {#watch}
2
-
3
- - **Type:** `boolean`
4
- - **Default:** `!process.env.CI && process.stdin.isTTY`
5
- - **CLI:** `-w`, `--watch`, `--watch=false`
6
-
7
- Enable watch mode
8
-
9
- In interactive environments, this is the default, unless `--run` is specified explicitly.
10
-
11
- In CI, or when run from a non-interactive shell, "watch" mode is not the default, but can be enabled explicitly with this flag.
@@ -1,29 +0,0 @@
1
- # watchTriggerPatterns <CRoot /> <Version>3.2.0</Version>
2
-
3
- - **Type:** `WatcherTriggerPattern[]`
4
-
5
- Vitest reruns tests based on the module graph which is populated by static and dynamic `import` statements. However, if you are reading from the file system or fetching from a proxy, then Vitest cannot detect those dependencies.
6
-
7
- To correctly rerun those tests, you can define a regex pattern and a function that returns a list of test files to run.
8
-
9
- ```ts
10
- import { defineConfig } from 'vitest/config'
11
-
12
- export default defineConfig({
13
- test: {
14
- watchTriggerPatterns: [
15
- {
16
- pattern: /^src\/(mailers|templates)\/(.*)\.(ts|html|txt)$/,
17
- testsToRun: (id, match) => {
18
- // relative to the root value
19
- return `./api/tests/mailers/${match[2]}.test.ts`
20
- },
21
- },
22
- ],
23
- },
24
- })
25
- ```
26
-
27
- ::: warning
28
- Returned files should be either absolute or relative to the root. Note that this is a global option, and it cannot be used inside of [project](/guide/projects) configs.
29
- :::