Skip to content

Commit 38bd075

Browse files
committed
docs(en): merging all conflicts
2 parents a060a86 + fc48485 commit 38bd075

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

config/coverage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ npx vitest --coverage.enabled --coverage.provider=istanbul
133133

134134
你可以在 Vitest UI 模式中查看代码覆盖率报告。更多详情请参阅 [Vitest UI Coverage](/guide/coverage#vitest-ui)
135135

136+
::: tip AI coding agents
137+
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.
138+
:::
139+
136140
## coverage.reportOnFailure {#coverage-reportonfailure}
137141

138142
- **类型:** `boolean`

config/experimental.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,41 @@ export default {
477477

478478
如果禁用模块运行器,Vitest 会使用原生 [Node.js 模块加载器](https://nodejs.org/api/module.html#customization-hooks) 来转换文件,以支持 `import.meta.vitest``vi.mock``vi.hoisted` 功能。
479479

480+
<<<<<<< HEAD
480481
如果你不使用这些特性,可禁用此功能以提升性能。
482+
=======
483+
If you don't use these features, you can disable this to improve performance.
484+
485+
## experimental.preParse <Version type="experimental">4.1.3</Version> {#experimental-preparse}
486+
487+
- **Type:** `boolean`
488+
- **Default:** `false`
489+
490+
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.
500+
501+
```ts
502+
// ✅ works — static string literal
503+
test('adds numbers', () => {})
504+
505+
// ✅ works — static tags
506+
test('my test', { tags: ['unit'] }, () => {})
507+
508+
// ❌ won't match correctly — dynamic name
509+
const name = getName()
510+
test(name, () => {})
511+
512+
// ❌ won't match correctly — dynamic tags
513+
const tags = getTags()
514+
test('my test', { tags }, () => {})
515+
```
516+
:::
517+
>>>>>>> fc4848519eb94e3429e973de7a38d3c4a8e841f5

guide/cli-generated.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,3 +963,10 @@ watch 模式下重新运行测试时清除终端屏幕(默认值:`true`)
963963
- **Config:** [experimental.vcsProvider](/config/experimental#experimental-vcsprovider)
964964

965965
Custom provider for detecting changed files. (default: `git`)
966+
967+
### experimental.preParse
968+
969+
- **CLI:** `--experimental.preParse`
970+
- **Config:** [experimental.preParse](/config/experimental#experimental-preparse)
971+
972+
Parse test specifications before running them. This will apply `.only` flag and test name pattern across all files without running them. (default: `false`)

guide/coverage.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,12 @@ export function ignored() { // [!code error]
510510

511511
<img alt="html coverage in Vitest UI" img-light src="/ui-coverage-1-light.png">
512512
<img alt="html coverage in Vitest UI" img-dark src="/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.

0 commit comments

Comments
 (0)