You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Vitest detects it is running inside an AI coding agent, it automatically adds the `text-summary` reporter and sets `skipFull: true` on the `text` reporter to reduce output and minimize token usage.
Parses test specifications before running them. This applies the [`.only`](/api/test#test-only) modifier, the [`-t`](/config/testnamepattern) test name pattern, [`--tags-filter`](/guide/test-tags#syntax), [test lines](/api/advanced/test-specification#testlines), and [test IDs](/api/advanced/test-specification#testids) across all files without executing them. For example, if only a single test is marked with `.only`, Vitest will skip all other tests in all files.
491
+
492
+
::: tip
493
+
This option is recommended when using [`.only`](/api/test#test-only), the [`-t`](/config/testnamepattern) flag, or [`--tags-filter`](/guide/test-tags#syntax).
494
+
495
+
Enabling it unconditionally may slow down your test runs due to the additional parsing step.
496
+
:::
497
+
498
+
::: warning
499
+
Pre-parsing uses static analysis (AST parsing) instead of executing your test files. This means that test names, tags, and modifiers (`.only`, `.skip`, `.todo`) must be statically analyzable. Dynamic test names (e.g., names stored in variables or returned from function calls) and non-literal tags will not be resolved correctly.
Vitest will prompt you to install certain dependencies if they are not already installed. You can disable this behavior by setting the `VITEST_SKIP_INSTALL_CHECKS=1` environment variable.
88
+
89
+
## Config Options
90
+
91
+
Configuration options that are not supported inside a [project](/guide/projects) config have <CRoot /> icon next to them. This means they can only be set in the root Vitest config.
Parse test specifications before running them. This will apply `.only` flag and test name pattern across all files without running them. (default: `false`)
<imgalt="html coverage in Vitest UI"img-lightsrc="/ui-coverage-1-light.png">
512
512
<imgalt="html coverage in Vitest UI"img-darksrc="/ui-coverage-1-dark.png">
513
+
514
+
## Coverage in Agent Environments
515
+
516
+
When Vitest detects it is running inside an AI coding agent, it automatically adjusts the default `text` reporter to reduce output and minimize token usage:
517
+
518
+
-`skipFull: true` is set on the `text` reporter, so files with 100% coverage are omitted from the terminal output.
519
+
- The [`text-summary`](/config/coverage#coverage-reporter) reporter is added automatically, so the agent always sees a concise totals table even when `skipFull` hides all individual files.
520
+
521
+
These adjustments only apply when the `text` reporter is already part of the active reporter list (it is included in the default). Explicitly configured reporters are never removed.
The underlying [Chai assertion](https://www.chaijs.com/guide/plugins/) object. This is the same instance that Chai plugins receive, giving you access to Chai's flag system and chainable methods. This can be useful for building custom matchers that need to interact with Chai's internals.
Copy file name to clipboardExpand all lines: guide/features.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,25 @@ import FeaturesList from '../.vitepress/components/FeaturesList.vue'
17
17
18
18
<divh-2 />
19
19
20
+
<<<<<<< HEAD
20
21
与 Vite 的配置、转换器、解析器和插件通用,将会使用应用中的相同配置来运行测试。
22
+
=======
23
+
::: tip
24
+
This page is a high-level overview of Vitest's capabilities. If you're new to Vitest, we recommend reading the [Learn](/guide/learn/writing-tests) tutorial first for a hands-on introduction.
Copy file name to clipboardExpand all lines: guide/index.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,12 @@
1
1
---
2
+
<<<<<<< HEAD
2
3
title: 快速起步 | 指南
4
+
=======
5
+
title: Getting Started | Guide
6
+
next:
7
+
text: Writing Tests
8
+
link: /guide/learn/writing-tests
9
+
>>>>>>> a141f9d49fa021ae0f1d6962f9dbc8bce3bbdd16
3
10
---
4
11
5
12
# 快速起步 {#getting-started}
@@ -95,10 +102,17 @@ Test Files 1 passed (1)
95
102
如果使用 Bun 作为软件包管理器,请确保使用 `bun run test` 命令而不是 `bun test` 命令,否则 Bun 将运行自己的测试运行程序。
96
103
:::
97
104
105
+
<<<<<<< HEAD
98
106
了解更多关于 Vitest 的使用,请参考 [API 索引](/api/test) 部分。
107
+
=======
108
+
Your first test is passing! Continue to [Writing Tests](/guide/learn/writing-tests) to learn about organizing tests, reading test output, and the core testing patterns you'll use every day.
109
+
110
+
To run tests once without watching for file changes, use `vitest run`. You can also pass additional flags like `--reporter` or `--coverage`. For a full list of CLI options, run `npx vitest --help` or see the [CLI guide](/guide/cli).
111
+
>>>>>>> a141f9d49fa021ae0f1d6962f9dbc8bce3bbdd16
99
112
100
113
## 配置 Vitest {#configuring-vitest}
101
114
115
+
<<<<<<< HEAD
102
116
Vitest 的主要优势之一是它与 Vite 的统一配置。如果存在,`vitest` 将读取你的根目录 `vite.config.ts` 以匹配插件并设置为你的 Vite 应用。例如,你的 Vite 有 [resolve.alias](https://cn.vitejs.dev/config/#resolve-alias) 和 [plugins](https://cn.vitejs.dev/guide/using-plugins.html) 的配置将会在 Vitest 中开箱即用。如果你想在测试期间想要不同的配置,你可以:
Vitest reads your `vite.config.*` by default, so your existing Vite plugins and configuration work out-of-the-box. You can also create a dedicated `vitest.config.*` for test-specific settings. See the [Config Reference](/config/) for details.
0 commit comments