DEV Community

Discussion on: Add testing to Vite

Collapse
soetz profile image
Sœtz - Simon Lecutiez • Edited on

Hey! Thanks a load for this, but it seems it doesn’t work for me… The error I got says Cannot find module './xxx.vue' or its corresponding type declarations.. I tried searching for ways to fix this but couldn’t understand what’s wrong. :( It’s such a shame because Vite was a nice experience until then.

Collapse
geminii profile image
Jimmy

I got the same error. How to fix this ?

Collapse
vuesomedev profile image
Gábor Soós Author

Can you share code alongside the error message?

Collapse
soetz profile image
Sœtz - Simon Lecutiez

I tried it again, and I think I got it right this time. Thanks!

Collapse
odinkraa profile image
xl ama slim fit

I had the same problem, got it to working by downing
jest version to 26.6.3
ts-jest to 26.5.6

here is my package.json

{
"name": "vite-testing",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"serve": "vite preview",
"test": "jest src"
},
"dependencies": {
"vue": "^3.2.13"
},
"devDependencies": {
"@types/jest": "^26.0.2",
"@vitejs/plugin-vue": "^1.9.0",
"@vue/test-utils": "^2.0.0-rc.15",
"jest": "^26.6.3",
"ts-jest": "^26.5.6",
"typescript": "^4.4.3",
"vite": "^2.5.10",
"vue-jest": "^5.0.0-alpha.10",
"vue-tsc": "^0.3.0"
}
}

Collapse
odinkraa profile image
xl ama slim fit

the problem now is it's passing while it shouldn't lol