@@ -33,13 +33,13 @@ if (task.type === 'module') {
3333' example.test.ts' // ✅
3434' project\\ example.test.ts' // ❌
3535```
36- <!-- TODO: translation -->
36+
3737## viteEnvironment <Version >4.1.0</Version > {#viteenvironment}
3838
39- This is a Vite's [ ` DevEnvironment ` ] ( https://vite.dev/guide/api-environment ) that transforms all files inside of the test module.
39+ 这是一个 Vite 的 [ ` DevEnvironment ` ] ( https://cn. vite.dev/guide/api-environment ) ,它会转换测试模块内的所有文件。
4040
41- ::: details History
42- - ` v4.0.15 ` : added as experimental
41+ ::: details 历史
42+ - ` v4.0.15 ` :已作为实验性功能
4343:::
4444
4545## state
@@ -88,51 +88,52 @@ function diagnostic(): ModuleDiagnostic
8888` ` ` ts
8989interface ModuleDiagnostic {
9090 /**
91- * 导入和初始化环境所需的时间。
91+ * 导入和初始化环境所需的时间
9292 */
9393 readonly environmentSetupDuration: number
9494 /**
95- * Vitest 设置测试运行环境(运行器、模拟等)所需的时间。
95+ * Vitest 设置测试运行环境(运行器、模拟等)所需的时间
9696 */
9797 readonly prepareDuration: number
9898 /**
99- * 导入测试模块所需的时间。
100- * 这包括导入模块中的所有内容以及执行套件回调函数。
99+ * 导入测试模块所需的时间
100+ * 这包括导入模块中的所有内容以及执行套件回调函数
101101 */
102102 readonly collectDuration: number
103103 /**
104- * 导入设置模块所需的时间。
104+ * 导入设置模块所需的时间
105105 */
106106 readonly setupDuration: number
107107 /**
108108 * 模块中所有测试和钩子函数的累计持续时间。
109109 */
110110 readonly duration: number
111111 /**
112- * 模块使用的内存量(以字节为单位)。
113- * 此值仅在使用 ` logHeapUsage ` 参数执行测试时才可用。
112+ * 模块使用的内存量(以字节为单位)
113+ * 此值仅在使用 ` logHeapUsage ` 参数执行测试时才可用
114114 */
115115 readonly heap: number | undefined
116116 /**
117- * Vitest处理的每个非外部化依赖项的导入时间。
117+ * Vitest处理的每个非外部化依赖项的导入时间
118118 */
119119 readonly importDurations: Record<string, ImportDuration>
120120 /**
121- * The id of the worker that ran this file. This value cannot be higher than ` maxWorkers ` .
122- * If file did not run yet, this will be 0.
121+ * 运行此文件的 worker 的 ID。此值不能高于 ` maxWorkers ` 。
122+ * 如果文件尚未运行,此值将为 0。
123123 *
124- * **Warning**: Node.js tests and browser tests run in different pools and do not share ` concurrencyId ` .
125- * It is possible to have multiple modules with the same ` concurrencyId ` because of that.
126- * Use ` project .isBrowserEnabled ()` to distinguish the concurrency.
124+ * **警告**: Node.js 测试和浏览器测试在不同的池中运行,不共享 ` concurrencyId `
125+ * 因此,可能存在多个具有相同 ` concurrencyId ` 的模块。
126+ * 使用 ` project .isBrowserEnabled ()` 来区分并发性。
127127 */
128128 readonly concurrencyId: number
129129 /**
130- * Incremental number of the worker that ran this file. This number increases with each worker.
131- * If file did not run yet, this will be 0.
130+ * å
131+ * 运行此文件的 worker 的递增编号。编号随每个 worker 进行递增
132+ * 如果文件尚未运行,此值将为 0
132133 *
133- * **Warning**: Node.js tests and browser tests run in different pools and do not share ` workerId ` .
134- * It is possible to have multiple modules with the same ` workerId ` because of that.
135- * Use ` project .isBrowserEnabled ()` to distinguish the concurrency.
134+ * **警告**: Node.js 测试和浏览器测试在不同的池中运行,不共享 ` workerId `
135+ * 因此,可能存在多个具有相同 ` workerId ` 的模块
136+ * 使用 ` project .isBrowserEnabled ()` 来区分并发性
136137 */
137138 readonly workerId: number
138139}
@@ -146,14 +147,14 @@ interface ImportDuration {
146147 totalTime: number
147148}
148149` ` `
149- < ! -- TODO : translation -- >
150+
150151## logs < Version > 5.0 .0 < / Version > {#logs }
151152
152153` ` ` ts
153154function logs(): ReadonlyArray<UserConsoleLog>
154155` ` `
155156
156- Console logs recorded on top level of the module during test collection . For example :
157+ 测试收集期间在模块顶层记录的 console 日志。例如:
157158
158159` ` ` ts
159160console.log('included') // [!code highlight]
0 commit comments