vuejs / vue-jest

Jest Vue transformer
MIT License
746 stars 157 forks source link

Support vue 2.7 #482

Closed last-partizan closed 2 years ago

last-partizan commented 2 years ago

Hello

According to Vue 2.7 is Now in Beta vue-2.7 does not use vue-template-compiler anymore.

And when running jest (with @vue/vue2-jest), it crashes with following message:

Error:

Vue packages version mismatch:

- vue@2.7.0-beta.5 (/app/node_modules/.pnpm/vue@2.7.0-beta.5/node_modules/vue/dist/vue.runtime.common.js)
- vue-template-compiler@2.6.14 (/app/node_modules/.pnpm/vue-template-compiler@2.6.14/node_modules/vue-template-compiler/package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

    at Object.<anonymous> (/app/node_modules/.pnpm/vue-template-compiler@2.6.14/node_modules/vue-template-compiler/index.js:10:9)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/node_modules/.pnpm/@vue+vue2-jest@28.0.0_5p35udu6dyqu4e55nl3ercvuxm/node_modules/@vue/vue2-jest/lib/process.js:3:29)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

Can you please add support for vue 2.7?

NikhilVerma commented 2 years ago

I am using

"@vue/test-utils": "^1.3.0",
"vue": "2.7.0",
"vue-template-compiler": "2.7.0"

And I can run my tests fine, can you try to equalise the dependencies?

If that doesn't work try this in your package.json (if you are using yarn)

"resolutions": {
    "vue": "2.7.0",
    "vue-template-es2015-compiler": "npm:vue-template-babel-compiler@1.2.0",
    "vue-template-babel-compiler": "npm:vue-template-babel-compiler@1.2.0"
  }
ankurk91 commented 2 years ago

I think we still need to have vue-template-compiler installed for test cases

last-partizan commented 2 years ago

Yeah, i updated everything to compatible versions and it works.

Thanks!