问题
When scaffolding a new project with the Vue.js CLI, it offers a choice of both unit-testing and E2E-testing frameworks.
Unit-testing functionality is perfectly adequate in Cypress. My question, then: is there an advantage to using a distinct unit-testing framework if I'm already using Cypress?
回答1:
There is a third-party adapter made by a Cypress contributor here called cypress-vue-unit-test(along with unit-test adapters for other popular frameworks).
You should check that out and see if it meets your needs over, say, Jest
From this tutorial about unit testing vuejs
, some Jest
advantages over Cypress
are:
- Built in code coverage
- Snapshot testing
- Module mocking utilities
Also see repo for vue-test-utils
来源:https://stackoverflow.com/questions/54764650/do-i-need-a-unit-testing-framework-if-im-already-using-cypress-in-a-vue-js-app