Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/assert-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
你可以使用此函数作为 [`expectTypeOf`](/api/expect-typeof) 的替代方法,以轻松地断言参数类型等于提供的泛型。

::: warning
在运行时,此函数不执行任何操作。要 [启用 typechecking](/guide/testing-types#run-typechecking),不要忘记传递 `--typecheck` 标志。
在运行时,此函数不执行任何操作。要 [启用类型检查](/guide/testing-types#run-typechecking),不要忘记传递 `--typecheck` 标志。
:::

```ts
Expand Down
1 change: 0 additions & 1 deletion api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ test.each`

- 第一行应为列名,用 `|` 分隔;
- 使用 `${value}` 语法,以模板字面表达式的形式提供后面一行或多行数据。
-

```ts
test.each`
Expand Down
4 changes: 2 additions & 2 deletions guide/browser/component-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ outline: deep

Vitest为多个框架提供全面的组件测试支持,包括Vue、React、Svelte、Lit、Preact、Qwik、Solid、Marko等。本指南涵盖了使用Vitest有效测试组件的特定模式、工具和最佳实践。

## 为什么进行组件测试?{#why-component-testing}
## 为什么进行组件测试? {#why-component-testing}

组件测试位于单元测试和端到端测试之间,提供了几个优势:

Expand All @@ -22,7 +22,7 @@ Vitest为多个框架提供全面的组件测试支持,包括Vue、React、Sve

Vitest中的组件测试使用**浏览器模式**在真实浏览器环境中运行测试,支持使用Playwright、WebdriverIO或预览模式。这提供了最准确的测试环境,因为你的组件在真实浏览器中运行,具有实际的DOM实现、CSS渲染和浏览器API。

### 为什么使用浏览器模式?{#why-browser-mode}
### 为什么使用浏览器模式? {#why-browser-mode}

浏览器模式是组件测试的推荐方法,因为它提供了最准确的测试环境。与DOM模拟库不同,浏览器模式能够捕获影响用户的真实世界问题。

Expand Down
2 changes: 1 addition & 1 deletion guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ vi.spyOn(exports, 'getter', 'get').mockReturnValue('mocked')
此方法在浏览器模式中无法使用。如需替代方案,请查看 [限制部分](/guide/browser/#spying-on-module-exports)。
:::

### 对模块中导出的函数进行 mock。{#mock-an-exported-function}
### 对模块中导出的函数进行 mock。 {#mock-an-exported-function}

```ts
import * as exports from 'some-path'
Expand Down