首页 > 解决方案 > Vue.js 单元测试最佳实践

问题描述

这是一个普遍的问题。但我很想问:vue js 单元测试有很多包。

哪一个是企业项目的最佳实践或推荐?

标签: javascriptvue.jsvuejs2vue-cli-3vue-test-utils

解决方案


These are not comparable, as each of them serve a different purpose.

From documentation of each of these libraries:

vue-test-utils

Vue Test Utils is the official unit testing utility library for Vue.js.

vue-jest

... To teach Jest how to process *.vue files, we will need to install and configure the vue-jest preprocessor.

cypress-vue-unit-test

A little helper to unit test Vue components in the open source Cypress.io E2E test runner

If you have no preference and looking for a place to start, then definitely start with official documentation: Choosing a test runner


推荐阅读