Skip to content

Commit 484c532

Browse files
committed
docs(cn): dissolve the conflict
1 parent 6ec637b commit 484c532

37 files changed

Lines changed: 40 additions & 488 deletions

api/advanced/vitest.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,7 @@ function start(filters?: string[]): Promise<TestRunResult>
244244
function standalone(): Promise<void>
245245
```
246246

247-
<<<<<<< HEAD
248-
- **别名:**: `init` <Deprecated />
249-
=======
250-
- **Alias:** `init` <Deprecated />
251-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
247+
- **别名:** `init` <Deprecated />
252248

253249
初始化报告器和覆盖率提供者。此方法不运行任何测试。如果提供了 `--watch` 标志,Vitest 仍将运行更改的测试,即使未调用此方法。
254250

@@ -700,7 +696,7 @@ export interface SourceModuleDiagnostic {
700696
::: warning
701697
[浏览器模式](/guide/browser/) 暂不支持。
702698
:::
703-
699+
<!-- TODO: translation -->
704700
## createReport <Version>5.0.0</Version> {#createreport}
705701

706702
```ts
@@ -738,7 +734,6 @@ const report = vitest.createReport('my-json-reporter')
738734
const root = report.root
739735
```
740736

741-
742737
### Report.clean
743738

744739
```ts
@@ -818,4 +813,3 @@ const report = vitest.createReport('my-json-reporter')
818813
// Deletes file from .vitest/my-json-reporter/test-report.json
819814
await report.delete('test-report.json')
820815
```
821-

api/assert.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ test('assert.fail', () => {
3535

3636
## isOk
3737

38-
<<<<<<< HEAD
3938
- **类型:** `<T>(value: T, message?: string) => asserts value`
40-
- **Alias** `ok`
41-
=======
42-
- **Type:** `<T>(value: T, message?: string) => asserts value`
43-
- **Alias:** `ok`
44-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
39+
- **别名:** `ok`
4540

4641
断言给定的 `value` 是 true 。
4742

@@ -56,13 +51,8 @@ test('assert.isOk', () => {
5651

5752
## isNotOk
5853

59-
<<<<<<< HEAD
6054
- **类型:** `<T>(value: T, message?: string) => void`
61-
- **Alias** `notOk`
62-
=======
63-
- **Type:** `<T>(value: T, message?: string) => void`
64-
- **Alias:** `notOk`
65-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
55+
- **别名:** `notOk`
6656

6757
断言给定的 `value` 是 false 。
6858

api/expect.md

Lines changed: 14 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,11 +1077,7 @@ test('spy function', () => {
10771077

10781078
## toHaveBeenCalledTimes
10791079

1080-
<<<<<<< HEAD
1081-
- **类型**: `(amount: number) => Awaitable<void>`
1082-
=======
1083-
- **Type:** `(amount: number) => Awaitable<void>`
1084-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1080+
- **类型:** `(amount: number) => Awaitable<void>`
10851081

10861082
这个断言检查函数是否被调用了特定次数。需要将一个 spy 函数传递给 `expect`
10871083

@@ -1106,11 +1102,7 @@ test('spy function called two times', () => {
11061102

11071103
## toHaveBeenCalledWith
11081104

1109-
<<<<<<< HEAD
1110-
- **类型**: `(...args: any[]) => Awaitable<void>`
1111-
=======
1112-
- **Type:** `(...args: any[]) => Awaitable<void>`
1113-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1105+
- **类型:** `(...args: any[]) => Awaitable<void>`
11141106

11151107
这个断言检查函数是否至少一次被调用,并带有特定的参数。需要将一个 spy 函数传递给 `expect`
11161108

@@ -1136,11 +1128,7 @@ test('spy function', () => {
11361128

11371129
## toHaveBeenCalledBefore
11381130

1139-
<<<<<<< HEAD
1140-
- **类型**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
1141-
=======
1142-
- **Type:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
1143-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1131+
- **类型:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
11441132

11451133
这个断言检查一个 `Mock` 是否在另一个 `Mock` 之前被调用。
11461134

@@ -1159,11 +1147,7 @@ test('calls mock1 before mock2', () => {
11591147

11601148
## toHaveBeenCalledAfter
11611149

1162-
<<<<<<< HEAD
1163-
- **类型**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
1164-
=======
1165-
- **Type:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
1166-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1150+
- **类型:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable<void>`
11671151

11681152
这个断言检查一个 `Mock` 是否在另一个 `Mock` 之后被调用。
11691153

@@ -1182,11 +1166,7 @@ test('calls mock1 after mock2', () => {
11821166

11831167
## toHaveBeenCalledExactlyOnceWith
11841168

1185-
<<<<<<< HEAD
1186-
- **类型**: `(...args: any[]) => Awaitable<void>`
1187-
=======
1188-
- **Type:** `(...args: any[]) => Awaitable<void>`
1189-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1169+
- **类型:** `(...args: any[]) => Awaitable<void>`
11901170

11911171
这个断言检查函数是否恰好被调用了一次,并且带有特定的参数。需要将一个 spy 函数传递给 `expect`
11921172

@@ -1210,11 +1190,7 @@ test('spy function', () => {
12101190

12111191
## toHaveBeenLastCalledWith
12121192

1213-
<<<<<<< HEAD
1214-
- **类型**: `(...args: any[]) => Awaitable<void>`
1215-
=======
1216-
- **Type:** `(...args: any[]) => Awaitable<void>`
1217-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1193+
- **类型:** `(...args: any[]) => Awaitable<void>`
12181194

12191195
这个断言检查函数在其最后一次调用时是否被传入了特定的参数。需要将一个 spy 函数传递给 `expect`
12201196

@@ -1240,11 +1216,7 @@ test('spy function', () => {
12401216

12411217
## toHaveBeenNthCalledWith
12421218

1243-
<<<<<<< HEAD
1244-
- **类型**: `(time: number, ...args: any[]) => Awaitable<void>`
1245-
=======
1246-
- **Type:** `(time: number, ...args: any[]) => Awaitable<void>`
1247-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1219+
- **类型:** `(time: number, ...args: any[]) => Awaitable<void>`
12481220

12491221
这个断言检查函数是否在特定的次数被调用时带有特定的参数。计数从 1 开始。因此,要检查第二次调用,我们需要写成 `.toHaveBeenNthCalledWith(2, ...)`
12501222

@@ -1271,11 +1243,7 @@ test('first call of spy function called with right params', () => {
12711243

12721244
## toHaveReturned
12731245

1274-
<<<<<<< HEAD
1275-
- **类型**: `() => Awaitable<void>`
1276-
=======
1277-
- **Type:** `() => Awaitable<void>`
1278-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1246+
- **类型:** `() => Awaitable<void>`
12791247

12801248
这个断言检查函数是否至少成功返回了一次值( i.e. ,没有抛出错误)。需要将一个 spy 函数传递给 `expect`
12811249

@@ -1299,11 +1267,7 @@ test('spy function returned a value', () => {
12991267

13001268
## toHaveReturnedTimes
13011269

1302-
<<<<<<< HEAD
1303-
- **类型**: `(amount: number) => Awaitable<void>`
1304-
=======
1305-
- **Type:** `(amount: number) => Awaitable<void>`
1306-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1270+
- **类型:** `(amount: number) => Awaitable<void>`
13071271

13081272
这个断言检查函数是否在确切的次数内成功返回了值( i.e. ,没有抛出错误)。需要将一个 spy 函数传递给 `expect`
13091273

@@ -1322,11 +1286,7 @@ test('spy function returns a value two times', () => {
13221286

13231287
## toHaveReturnedWith
13241288

1325-
<<<<<<< HEAD
1326-
- **类型**: `(returnValue: any) => Awaitable<void>`
1327-
=======
1328-
- **Type:** `(returnValue: any) => Awaitable<void>`
1329-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1289+
- **类型:** `(returnValue: any) => Awaitable<void>`
13301290

13311291
我们可以调用这个断言来检查函数是否至少一次成功返回了带有特定参数的值。需要将一个 spy 函数传递给 `expect`
13321292

@@ -1344,11 +1304,7 @@ test('spy function returns a product', () => {
13441304

13451305
## toHaveLastReturnedWith
13461306

1347-
<<<<<<< HEAD
1348-
- **类型**: `(returnValue: any) => Awaitable<void>`
1349-
=======
1350-
- **Type:** `(returnValue: any) => Awaitable<void>`
1351-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1307+
- **类型:** `(returnValue: any) => Awaitable<void>`
13521308

13531309
我们可以使用这个断言来检查函数在最后一次被调用时是否成功返回了特定的值。需要将一个 spy 函数传递给 `expect`
13541310

@@ -1367,11 +1323,7 @@ test('spy function returns bananas on a last call', () => {
13671323

13681324
## toHaveNthReturnedWith
13691325

1370-
<<<<<<< HEAD
1371-
- **类型**: `(time: number, returnValue: any) => Awaitable<void>`
1372-
=======
1373-
- **Type:** `(time: number, returnValue: any) => Awaitable<void>`
1374-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1326+
- **类型:** `(time: number, returnValue: any) => Awaitable<void>`
13751327

13761328
我们可以调用这个断言来检查函数是否在特定的调用中成功返回了带有特定参数的值。需要将一个 spy 函数传递给 `expect`
13771329

@@ -1392,11 +1344,7 @@ test('spy function returns bananas on second call', () => {
13921344

13931345
## toHaveResolved
13941346

1395-
<<<<<<< HEAD
1396-
- **类型**: `() => Awaitable<void>`
1397-
=======
1398-
- **Type:** `() => Awaitable<void>`
1399-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1347+
- **类型:** `() => Awaitable<void>`
14001348

14011349
这个断言检查函数是否至少一次成功地解析了一个值( i.e. ,没有被拒绝)。需要将一个 spy 函数传递给 `expect`
14021350

@@ -1422,11 +1370,7 @@ test('spy function resolved a value', async () => {
14221370

14231371
## toHaveResolvedTimes
14241372

1425-
<<<<<<< HEAD
1426-
- **类型**: `(amount: number) => Awaitable<void>`
1427-
=======
1428-
- **Type:** `(amount: number) => Awaitable<void>`
1429-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1373+
- **类型:** `(amount: number) => Awaitable<void>`
14301374

14311375
此断言检查函数是否已成功解析值精确次数(即未 reject)。需要将 spy 函数传递给`expect`
14321376

@@ -1447,11 +1391,7 @@ test('spy function resolved a value two times', async () => {
14471391

14481392
## toHaveResolvedWith
14491393

1450-
<<<<<<< HEAD
14511394
- **类型:** `(returnValue: any) => Awaitable<void>`
1452-
=======
1453-
- **Type:** `(returnValue: any) => Awaitable<void>`
1454-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
14551395

14561396
您可以调用此断言来检查函数是否至少成功解析过一次某个值。需要将 spy 函数传递给`expect`
14571397

@@ -1471,11 +1411,7 @@ test('spy function resolved a product', async () => {
14711411

14721412
## toHaveLastResolvedWith
14731413

1474-
<<<<<<< HEAD
14751414
- **类型:** `(returnValue: any) => Awaitable<void>`
1476-
=======
1477-
- **Type:** `(returnValue: any) => Awaitable<void>`
1478-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
14791415

14801416
您可以调用此断言来检查函数在上次调用时是否已成功解析某个值。需要将 spy 函数传递给`expect`
14811417

@@ -1496,11 +1432,7 @@ test('spy function resolves bananas on a last call', async () => {
14961432

14971433
## toHaveNthResolvedWith
14981434

1499-
<<<<<<< HEAD
15001435
- **类型:** `(time: number, returnValue: any) => Awaitable<void>`
1501-
=======
1502-
- **Type:** `(time: number, returnValue: any) => Awaitable<void>`
1503-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
15041436

15051437
你可以调用此断言来检查函数在特定调用中是否成功解析了某个值。需要将一个 spy 函数传递给 `expect`
15061438

api/test.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,13 +614,9 @@ test.each`
614614
expect(a + b).toBe(expected)
615615
})
616616
```
617-
617+
<!-- TODO: translation -->
618618
::: tip
619-
<<<<<<< HEAD
620-
Vitest 使用 Chai 的 `format` 方法处理 `$values`。如果值被截断,可在配置文件中调大 [chaiConfig.truncateThreshold](/config/chaiconfig#chaiconfig-truncatethreshold)
621-
=======
622619
Vitest formats interpolated title values with its display formatter. If the value is too truncated, you can increase [taskTitleValueFormatTruncate](/config/tasktitlevalueformattruncate) in your config file.
623-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
624620
:::
625621

626622
## test.for

config/allowonly.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ outline: deep
55

66
# allowOnly
77

8-
<<<<<<< HEAD
9-
- **类型:**: `boolean`
10-
- **默认值:**: `!process.env.CI`
8+
- **类型:** `boolean`
9+
- **默认值:** `!process.env.CI`
1110
- **命令行终端:** `--allowOnly`, `--allowOnly=false`
12-
=======
13-
- **Type:** `boolean`
14-
- **Default:** `!process.env.CI`
15-
- **CLI:** `--allowOnly`, `--allowOnly=false`
16-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1711

1812
默认情况下,Vitest 不允许在持续集成(CI)环境中运行带有 [`only`](/api/test#test-only) 标记的测试。相反,在本地开发环境中,Vitest 允许运行这些测试。
1913

config/bail.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ outline: deep
55

66
# bail
77

8-
<<<<<<< HEAD
98
- **类型:** `number`
109
- **默认值:** `0`
1110
- **命令行终端:** `--bail=<value>`
12-
=======
13-
- **Type:** `number`
14-
- **Default:** `0`
15-
- **CLI:** `--bail=<value>`
16-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1711

1812
当指定数量的测试用例失败时立即终止测试执行。
1913

config/browser/provider.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ export default defineConfig({
6161
})
6262
```
6363

64-
<<<<<<< HEAD
6564
## 自定义 Provider <Badge type="danger">advanced</Badge> {#custom-provider}
66-
=======
67-
## Custom Provider <Badge type="danger">advanced</Badge> {#custom-provider}
68-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
6965

7066
::: danger 高级 API
7167
自定义 provider API 处于高度实验阶段,可能会在小版本之间发生变化。如果你只需要在浏览器中运行测试,请使用 [`browser.instances`](/config/browser/instances) 选项替代。

config/browser/trace.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ outline: deep
1010
- **默认值:** `'off'`
1111

1212
捕获浏览器测试运行的追踪记录。你可以通过 [Playwright Trace Viewer](https://trace.playwright.dev/) 预览追踪文件。
13-
14-
<<<<<<< HEAD
15-
该选项支持以下取值:
16-
=======
13+
<!-- TODO: translation -->
1714
See [Playwright Traces](/guide/browser/playwright-traces) for the full workflow.
1815

19-
This options supports the following values:
20-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
16+
该选项支持以下取值:
2117

2218
- `'on'` - 为所有测试捕获追踪记录(不推荐,因性能消耗较大)
2319
- `'off'` - 不捕获追踪记录

config/browser/traceview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ outline: deep
88
- **Type:** `boolean | { enabled?: boolean; recordCanvas?: boolean; inlineImages?: boolean }`
99
- **CLI:** `--browser.traceView`
1010
- **Default:** `false`
11-
11+
<!-- TODO: translation -->
1212
Enable trace-view collection for browser tests. Vitest captures DOM snapshots for browser interactions and can show them in the browser UI, Vitest UI, or HTML reporter when those surfaces are enabled — no external tools required.
1313

1414
```ts

config/cache.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ outline: deep
55

66
# cache <CRoot />
77

8-
<<<<<<< HEAD
98
- **类型:** `false`
109
- **命令行终端:** `--no-cache`, `--cache=false`
11-
=======
12-
- **Type:** `false`
13-
- **CLI:** `--no-cache`, `--cache=false`
14-
>>>>>>> ec964f36ce7596a023a32b8265f6019c51b32926
1510

1611
使用此选项可禁用缓存功能。当前 Vitest 会缓存测试结果,以便优先运行耗时较长和失败的测试。
1712

0 commit comments

Comments
 (0)