Skip to content

Commit 5da4e8b

Browse files
authored
Merge pull request #756 from WuMingDao/patch-9
docs(/advanced/api/test-case): Add comments translate
2 parents 587a0a9 + d758056 commit 5da4e8b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

advanced/api/test-case.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ ID 的格式如下:
6767
import { generateFileHash } from 'vitest/node'
6868

6969
const hash = generateFileHash(
70-
'/file/path.js', // relative path
71-
undefined // the project name or `undefined` is not set
70+
'/file/path.js', // 相对路径
71+
undefined // 未设置项目名称或 `undefined`
7272
)
7373
```
7474

@@ -151,11 +151,11 @@ function result(): TestResult
151151
```ts
152152
export interface TestResultPending {
153153
/**
154-
* The test was collected, but didn't finish running yet.
154+
* 测试已收集,但尚未完成运行。
155155
*/
156156
readonly state: 'pending'
157157
/**
158-
* Pending tests have no errors.
158+
* 待定测试没有错误。
159159
*/
160160
readonly errors: undefined
161161
}
@@ -166,16 +166,16 @@ export interface TestResultPending {
166166
```ts
167167
interface TestResultSkipped {
168168
/**
169-
* The test was skipped with `skip` or `todo` flag.
170-
* You can see which one was used in the `options.mode` option.
169+
* 使用 `skip` `todo` 标志跳过测试。
170+
* 你可以在 `options.mode` 选项中查看使用的是哪种模式。
171171
*/
172172
readonly state: 'skipped'
173173
/**
174-
* Skipped tests have no errors.
174+
* 跳过的测试没有错误。
175175
*/
176176
readonly errors: undefined
177177
/**
178-
* A custom note passed down to `ctx.skip(note)`.
178+
* 传给 `ctx.skip(note)` 的自定义注释。
179179
*/
180180
readonly note: string | undefined
181181
}
@@ -190,11 +190,11 @@ interface TestResultSkipped {
190190
```ts
191191
interface TestResultFailed {
192192
/**
193-
* The test failed to execute.
193+
* 测试执行失败。
194194
*/
195195
readonly state: 'failed'
196196
/**
197-
* Errors that were thrown during the test execution.
197+
* 测试执行过程中出现的错误。
198198
*/
199199
readonly errors: ReadonlyArray<TestError>
200200
}
@@ -205,11 +205,11 @@ interface TestResultFailed {
205205
```ts
206206
interface TestResultPassed {
207207
/**
208-
* The test passed successfully.
208+
* 测试成功通过。
209209
*/
210210
readonly state: 'passed'
211211
/**
212-
* Errors that were thrown during the test execution.
212+
* 测试执行过程中出现的错误。
213213
*/
214214
readonly errors: ReadonlyArray<TestError> | undefined
215215
}
@@ -230,33 +230,33 @@ function diagnostic(): TestDiagnostic | undefined
230230
```ts
231231
interface TestDiagnostic {
232232
/**
233-
* If the duration of the test is above `slowTestThreshold`.
233+
* 如果测试持续时间超过 `slowTestThreshold`
234234
*/
235235
readonly slow: boolean
236236
/**
237-
* The amount of memory used by the test in bytes.
238-
* This value is only available if the test was executed with `logHeapUsage` flag.
237+
* 测试使用的内存量(字节)。
238+
* 只有使用 `logHeapUsage` 标志执行测试时,该值才可用。
239239
*/
240240
readonly heap: number | undefined
241241
/**
242-
* The time it takes to execute the test in ms.
242+
* 执行测试所需的时间(毫秒)。
243243
*/
244244
readonly duration: number
245245
/**
246-
* The time in ms when the test started.
246+
* 测试开始的时间(毫秒)。
247247
*/
248248
readonly startTime: number
249249
/**
250-
* The amount of times the test was retried.
250+
* 测试重试的次数。
251251
*/
252252
readonly retryCount: number
253253
/**
254-
* The amount of times the test was repeated as configured by `repeats` option.
255-
* This value can be lower if the test failed during the repeat and no `retry` is configured.
254+
* 重复测试的次数,由 `repeats` 选项设置。
255+
* 如果测试在重复过程中失败,且未配置 `retry`,则该值可以更小。
256256
*/
257257
readonly repeatCount: number
258258
/**
259-
* If test passed on a second retry.
259+
* 如果第二次重试时测试通过。
260260
*/
261261
readonly flaky: boolean
262262
}

0 commit comments

Comments
 (0)