[英]How do I use Vue3 with vue-jest?
I have the following dependency...我有以下依赖...
"vue-jest": "latest",
But when I run npm install
I get...但是当我运行npm install
我得到...
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: vue@3.1.4
npm WARN node_modules/vue
npm WARN vue@"latest" from the root project
npm WARN 7 more (@headlessui/vue, @heroicons/vue, @vue/compiler-sfc, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^2.x" from vue-jest@3.0.7
npm WARN node_modules/vue-jest
npm WARN dev vue-jest@"latest" from the root project
I looked at the code and I see a lib called vue3-jest but that isn't available in npm...我查看了代码,看到了一个名为vue3-jest的库,但它在 npm 中不可用...
What is the proper way to get the version of vue-jest that uses vue3?获取使用 vue3 的 vue-jest 版本的正确方法是什么?
Depending on what Vue Test Utils for Vue3 installation guide , you should use vue-jest
v5 that is still in alpha because it's the one that supports Vue 3.根据什么Vue Test Utils for Vue3 安装指南,您应该使用仍处于 alpha 阶段的vue-jest
v5,因为它支持 Vue 3。
The latest
version is 3.0.7
. latest
版本是3.0.7
。 But the version you need is 5.0.0-alpha.10
.但是您需要的版本是5.0.0-alpha.10
。 It exists in the next
channel so you should be able to install it using:它存在于next
频道中,因此您应该能够使用以下方式安装它:
npm i vue-jest@next
You can check all vue-jest
versions here https://www.npmjs.com/package/vue-jest in the Versions tab你可以在这里查看所有vue-jest
版本https://www.npmjs.com/package/vue-jest在 Versions 选项卡中
since jest
v27,use vue3-jest instead.从jest
v27 开始,请改用 vue3-jest。
npm i vue3-jest
feat: support jest v27 in vue3-jest #343壮举:在 vue3-jest 中支持 jest v27 #343
To fix this use the latest @vue/vue3-jest package.要解决此问题,请使用最新的 @vue/vue3-jest 包。 NOT vue3-jest.不是 vue3-jest。
Read more here vue test utils TypeError: Cannot destructure property `config` of 'undefined' or 'null'在此处阅读更多内容vue test utils TypeError: Cannot destructure property `config` of 'undefined' or 'null'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.