Skip to content

Commit 371e030

Browse files
committed
docs(cn): dissolve the conflict
1 parent 9e4ac7b commit 371e030

2 files changed

Lines changed: 9 additions & 43 deletions

File tree

config/coverage.md

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,11 @@ npx vitest --coverage.enabled --coverage.provider=istanbul
233233

234234
### coverage.thresholds.perFile
235235

236-
<<<<<<< HEAD
237-
- **类型:** `boolean`
236+
- **类型:** `boolean | { 100?: boolean, lines?: number, functions?: number, branches?: number, statements?: number }`
238237
- **默认值:** `false`
239238
- **可用的测试提供者:** `'v8' | 'istanbul'`
240239
- **命令行终端:** `--coverage.thresholds.perFile`, `--coverage.thresholds.perFile=false`
241-
242-
按文件检查覆盖率阈值。
243-
=======
244-
- **Type:** `boolean | { 100?: boolean, lines?: number, functions?: number, branches?: number, statements?: number }`
245-
- **Default:** `false`
246-
- **Available for providers:** `'v8' | 'istanbul'`
247-
- **CLI:** `--coverage.thresholds.perFile`, `--coverage.thresholds.perFile=false`
248-
240+
<!-- TODO: translation -->
249241
When `true`, each file is checked against the top-level thresholds instead of the project-wide aggregate. When set to an object, both are checked: the aggregate against the top-level thresholds, and every file against these per-file minimums.
250242

251243
<!-- eslint-skip -->
@@ -302,7 +294,6 @@ When `true`, each file is checked against the top-level thresholds instead of th
302294
}
303295
}
304296
```
305-
>>>>>>> 89a0dbd2c3f2002cd2061b660fc7d0bd480e98eb
306297

307298
### coverage.thresholds.autoUpdate
308299

@@ -313,20 +304,14 @@ When `true`, each file is checked against the top-level thresholds instead of th
313304

314305
当实际覆盖率超过配置阈值时,自动将 `lines``functions``branches``statements` 的阈值更新到配置文件中。
315306
此选项适用于覆盖率提高时保持阈值不变。
316-
<!-- TODO: translation -->
307+
317308
你也可以通过传入函数自定义阈值更新值的格式,The function receives the new threshold as the first argument and the previous threshold as the second:
318309

319310
<!-- eslint-skip -->
320311
```ts
321312
{
322313
coverage: {
323314
thresholds: {
324-
<<<<<<< HEAD
325-
// 更新阈值为整数
326-
autoUpdate: (newThreshold) => Math.floor(newThreshold),
327-
328-
=======
329-
>>>>>>> 89a0dbd2c3f2002cd2061b660fc7d0bd480e98eb
330315
// Log the change and update without decimals
331316
autoUpdate: (newThreshold, previousThreshold) => {
332317
console.log(`Updated threshold from ${previousThreshold} to ${newThreshold}`)
@@ -352,29 +337,17 @@ When `true`, each file is checked against the top-level thresholds instead of th
352337

353338
### coverage.thresholds[glob-pattern]
354339

355-
<<<<<<< HEAD
356-
- **类型:** `{ statements?: number functions?: number branches?: number lines?: number }`
340+
- **类型:** `{ statements?: number, functions?: number, branches?: number, lines?: number, perFile?: boolean | object }`
357341
- **默认值:** `undefined`
358342
- **可用的测试提供者:** `'v8' | 'istanbul'`
359-
=======
360-
- **Type:** `{ statements?: number, functions?: number, branches?: number, lines?: number, perFile?: boolean | object }`
361-
- **Default:** `undefined`
362-
- **Available for providers:** `'v8' | 'istanbul'`
363-
>>>>>>> 89a0dbd2c3f2002cd2061b660fc7d0bd480e98eb
364343

365344
设置与 glob 模式匹配的文件的阈值。
345+
<!-- TODO: translation -->
346+
Each glob pattern can set its own `perFile` (`boolean | object`), checked exactly like the top-level `perFile` but scoped to the matched files. Glob patterns do not inherit the top-level `perFile` — set it per glob.
366347

367-
<<<<<<< HEAD
368348
::: tip 注意
369349
Vitest 会将所有文件(包括匹配 glob 模式的文件)计入全局覆盖率阈值计算。
370350
此做法与 Jest 不同。
371-
=======
372-
Each glob pattern can set its own `perFile` (`boolean | object`), checked exactly like the top-level `perFile` but scoped to the matched files. Glob patterns do not inherit the top-level `perFile` — set it per glob.
373-
374-
::: tip NOTE
375-
Vitest counts all files, including those covered by glob-patterns, into the global coverage thresholds.
376-
This is different from Jest behavior.
377-
>>>>>>> 89a0dbd2c3f2002cd2061b660fc7d0bd480e98eb
378351
:::
379352

380353
<!-- eslint-skip -->

guide/cli-generated.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,10 @@ Coverage reporters to use. Visit [`coverage.reporter`](/config/coverage#coverage
197197

198198
### coverage.thresholds.perFile
199199

200-
<<<<<<< HEAD
201-
- **命令行终端:** `--coverage.thresholds.perFile`
200+
- **命令行终端:** `--coverage.thresholds.perFile <boolean>`
202201
- **配置:** [coverage.thresholds.perFile](/config/coverage#coverage-thresholds-perfile)
203-
204-
检查每个文件的阈值。 `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches`, `--coverage.thresholds.statements` 为实际阈值(默认值:`false`
205-
=======
206-
- **CLI:** `--coverage.thresholds.perFile <boolean>`
207-
- **Config:** [coverage.thresholds.perFile](/config/coverage#coverage-thresholds-perfile)
208-
209-
Check thresholds per file. See `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches` and `--coverage.thresholds.statements` for the actual thresholds (default: `false`). Object form is available in config files only.
210-
>>>>>>> 89a0dbd2c3f2002cd2061b660fc7d0bd480e98eb
202+
<!-- TODO: translation -->
203+
检查每个文件的阈值。 `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches`, `--coverage.thresholds.statements` 为实际阈值(默认值:`false`)。Object form is available in config files only.
211204

212205
### coverage.thresholds.autoUpdate
213206

0 commit comments

Comments
 (0)