5

I have the following dependency...

"vue-jest": "latest",

But when I run npm install I get...

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...

What is the proper way to get the version of vue-jest that uses vue3?

Jose Gleeson
  • 173
  • 1
  • 11

3 Answers3

7

since jest v27,use vue3-jest instead.

npm i vue3-jest

feat: support jest v27 in vue3-jest #343

Li Kui
  • 640
  • 9
  • 21
5

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.

The latest version is 3.0.7. But the version you need is 5.0.0-alpha.10. It exists in the next channel so you should be able to install it using:

npm i vue-jest@next

You can check all vue-jest versions here https://www.npmjs.com/package/vue-jest in the Versions tab

Ahmed Rafik Ibrahim
  • 538
  • 1
  • 4
  • 16
0

To fix this use the latest @vue/vue3-jest package. NOT vue3-jest.

Read more here vue test utils TypeError: Cannot destructure property `config` of 'undefined' or 'null'

DanKodi
  • 3,550
  • 27
  • 26