From cdb29eba6ad8f5a785893194cf952775c7a50f58 Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Tue, 7 Jan 2025 20:30:03 +0800 Subject: [PATCH] docs(zh): review index --- docs/zh/guide/index.md | 12 ++++++------ docs/zh/index.md | 2 +- docs/zh/installation/index.md | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/zh/guide/index.md b/docs/zh/guide/index.md index 8f1d116d8..a3c613989 100644 --- a/docs/zh/guide/index.md +++ b/docs/zh/guide/index.md @@ -11,7 +11,7 @@ ## 什么是 Vue Test Utils? -Vue Test Utils (VTU) 是一组实用函数,旨在简化对 Vue.js 组件的测试。它提供了一些方法来以独立的方式挂载和与 Vue 组件进行交互。 +Vue Test Utils (VTU) 是一组实用函数,旨在简化 Vue.js 的组件测试。它提供了一些方法来独立地挂载 Vue 组件并与 Vue 组件进行交互。 让我们看一个例子: @@ -31,25 +31,25 @@ test('displays message', () => { } }) - // 断言组件的渲染文本 + // 断言组件渲染出的文本 expect(wrapper.text()).toContain('Hello world') }) ``` -Vue Test Utils 通常与测试运行器一起使用。流行的测试运行器包括: +Vue Test Utils 通常需要和一个测试运行器配合使用。流行的测试运行器包括: - [Vitest](https://vitest.dev/)。基于终端,具有实验性的浏览器 UI。 - [Cypress](https://cypress.io/)。基于浏览器,支持 Vite、webpack。 - [Playwright](https://playwright.dev/docs/test-components) (实验性) 基于浏览器,支持 Vite。 - [WebdriverIO](https://webdriver.io/docs/component-testing/vue)。基于浏览器,支持 Vite、Webpack,跨浏览器支持。 -Vue Test Utils 是一个简单且不拘泥于特定风格的库的库。如果你希望使用更具功能性、易用性和明确意见的工具,可以考虑 [Cypress 组件测试](https://docs.cypress.io/guides/component-testing/overview),它具有热重载开发环境,或者 [Testing Library](https://testing-library.com/docs/vue-testing-library/intro/),它在进行断言时强调可访问性选择器 (Accessibility)。这两种工具在底层都使用 Vue Test Utils,并暴露相同的 API。 +Vue Test Utils 是最小化且不含偏见的库。如果你想要功能更丰富、更易用且偏好更鲜明的工具,获取可以考虑具有热重载开发环境的 [Cypress Component Testing](https://docs.cypress.io/guides/component-testing/overview)、或者在断言时强调基于可访问性选择器的 [Testing Library](https://testing-library.com/docs/vue-testing-library/intro/)。这两种工具在底层都使用 Vue Test Utils 并暴露相同的 API。 ## 接下来做什么? -要查看 Vue Test Utils 的实际应用,请[查阅快速上手](../guide/essentials/a-crash-course.md),我们将使用测试优先的方法构建一个简单的待办事项应用。 +要查看 Vue Test Utils 的实际运用,请[查阅快速上手](../guide/essentials/a-crash-course.md),在那里,我们使用测试优先的思路构建了一个简单的待办事项应用。 -文档分为两个主要部分: +我们的文档分为两个主要部分: - **基础知识**,涵盖你在测试 Vue 组件时可能遇到的常见用例。 - **深入学习 Vue Test Utils**,探索库的其他高级功能。 diff --git a/docs/zh/index.md b/docs/zh/index.md index b7fa4b7d2..5a6927d64 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -2,7 +2,7 @@ layout: home title: Vue Test Utils -titleTemplate: Vue Test Utils for Vue.js 3 +titleTemplate: Vue.js 3 测试工具 hero: name: Vue Test Utils diff --git a/docs/zh/installation/index.md b/docs/zh/installation/index.md index e2274281d..b0760e363 100644 --- a/docs/zh/installation/index.md +++ b/docs/zh/installation/index.md @@ -14,9 +14,9 @@ yarn add --dev @vue/test-utils ## 用法 -Vue Test Utils 是与框架无关的 - 你可以与任何你喜欢的测试运行器一起使用。最简单的尝试方式是使用 [Jest](https://jestjs.io/),这是一个流行的测试运行器。 +Vue Test Utils 是与测试框架无关的——你可以与任何你喜欢的测试运行器一起使用。最简单的尝试方式是使用 [Jest](https://jestjs.io/),这是一个流行的测试运行器。 -要在 Jest 中加载 `.vue` 文件,你需要 `vue-jest`。`vue-jest` v5 是支持 Vue 3 的版本。它仍处于 alpha 阶段,就像 Vue.js 3 生态系统的其他部分一样,所以如果你发现错误,请在[这里](https://github.com/vuejs/vue-jest/)报告,并说明你正在使用 `vue-jest` v5。 +你需要 `vue-jest` 在 Jest 中加载 `.vue` 文件。`vue-jest` v5 是支持 Vue 3 的版本。它和 Vue.js 3 生态系统的其他部分一样仍处于 alpha 阶段。如果你发现任何错误,请在[这里](https://github.com/vuejs/vue-jest/)报告,并注明你正在使用 `vue-jest` v5。 你可以通过 `vue-jest@next` 安装它。然后,你需要使用 Jest 的 [transform](https://jestjs.io/docs/en/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object) 选项进行配置。