API 浏览器
Quasar CLI with Webpack - @quasar/app-webpack
测试与审核

你的 Quasar 项目可以添加单元测试和端到端测试工具。本介绍不会详细介绍如何编写和使用测试,为此请参阅专门准备和维护的 GitHub 上的测试仓库 文档。如果你是初学者,可以考虑阅读 “延伸阅读” 部分中的一本书。

¥Your Quasar projects have the ability to add unit and e2e testing harnesses. This introduction will not go into details about how to write and use tests, for that please consult the specially prepared and maintained documentation at the testing repo at GitHub. If you are a beginner, consider reading one of the books in the “Further Reading” section.

高级概述(High level overview)

¥High level overview

你可以通过运行一个简单的命令将多个预先安装的测试工具安装到你现有的 Quasar 应用中。此命令将拉取并安装一个节点模块(包含依赖)到项目的 package.json 中,根据需要放置必要的配置文件,并添加脚本命令以公开相应工具的一些功能。你可以添加多个线束,甚至将它们用于持续集成流水线。 - 视情况而定。

¥You can install multiple pre-rigged testing harnesses to your existing Quasar application by running a simple command. This command will pull and install a node module (with dependencies) into your project’s package.json, place necessary configuration files as appropriate and add script commands that expose some of the functionality of the respective harness. You can add multiple harnesses and even use them for your continuous integration pipelines - as appropriate.

测试本身并不难。最复杂的部分是设置测试工具。关键在于知道要测试什么。如果你是测试新手,务必熟悉一些概念和模式。本文档页面末尾有一些链接可供进一步阅读。

¥Testing is not in and of itself hard. The most complicated part is setting up the testing harness. The trick lies in knowing what to test. If you are new to testing, it is absolutely imperative that you familiarize yourself with some of the concepts and patterns. There are some links for further reading at the end of this document page.

测试文档(Testing documentation)

¥Testing documentation

你可以在 https://testing.quasar.dev 或 quasar-testing 仓库的 dev 分支 中找到测试 AE 的文档。

¥You can find the documentation of testing AEs at https://testing.quasar.dev or into dev branch of quasar-testing repo.

Testing AEs documentation

安装(Installing)

¥Installing

$ cd your-quasar-project

$ quasar ext add @quasar/testing-e2e-cypress
# or
$ quasar ext add @quasar/testing-unit-jest
# or
$ quasar ext add @quasar/testing-unit-vitest

这些扩展将安装相应的工具,你可以根据需要进行配置。它是 Quasar 项目中管理多个测试工具的理想方式。如果你需要检查安装选项,可以查看 quasar.extensions.json

¥These extension will install the respective harnesses, which you can configure as you like. It is how multiple testing harnesses are ideally managed within a Quasar project. If you ever need to review your installation choices you can take a look at quasar.extensions.json.

请注意,我们之前建议使用 @quasar/testing AE 来管理项目中的所有测试工具。与 现已弃用 一样,不再存在这种情况。请改用以上命令。

¥Note that we previously suggested to use @quasar/testing AE to manage all testing harnesses in a project. This is no longer the case, as it is now deprecated. Please use the above commands instead.

延伸阅读(Further Reading)

¥Further Reading

书籍(Books)

¥Books

教程(Tutorials)

¥Tutorials

文档(Documentation)

¥Documentation