vue单元测试
vue单元测试的最佳实践
itlixiaolong
这个作者很懒,什么都没留下…
展开
-
vue单元测试---组件挂载
mount和shallowMount区别mount会渲染整个组件树而shallowMount在挂载组件之前对所有子组件进行存根。shallowMount可以确保你对一个组件进行独立测试,有助于避免测试中因子组件的渲染输出而混乱结果。使用建议mount适合小组件测试shallowMount适合多场景测试(能用shallowMount就不用mount)...原创 2021-05-27 22:17:11 · 872 阅读 · 0 评论 -
vue单元测试环境的配置
配置.eslintrc文件,使eslint识别jest环境中的变量 "env": { "node": true, "jest": true },配置script的脚本,在跑单元测试前先运行eslint解决eslint报错"scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service li.原创 2021-05-27 21:57:20 · 281 阅读 · 0 评论