Is vitest compatible with wasp (vite)?

During vitest install I keep getting following error:
[ Wasp !] npm warn ERESOLVE overriding peer dependency
[ Wasp !] npm warn While resolving: @vitest/[email protected]
[ Wasp !] npm warn Found: [email protected]
[ Wasp !] npm warn node_modules/vite
[ Wasp !] npm warn dev vite@"^4.3.9" from the root project
[ Wasp !] npm warn
[ Wasp !] npm warn Could not resolve dependency:
[ Wasp !] npm warn peerOptional vite@"^5.0.0" from @vitest/[email protected]
[ Wasp !] npm warn node_modules/@vitest/mocker
[ Wasp !] npm warn @vitest/mocker@"2.1.1" from [email protected]
[ Wasp !] npm warn node_modules/vitest
[ Wasp !] npm warn
[ Wasp !] npm warn Conflicting peer dependency: [email protected]
[ Wasp !] npm warn node_modules/vite
[ Wasp !] npm warn peerOptional vite@"^5.0.0" from @vitest/[email protected]
[ Wasp !] npm warn node_modules/@vitest/mocker
[ Wasp !] npm warn @vitest/mocker@"2.1.1" from [email protected]
[ Wasp !] npm warn node_modules/vitest
[ Wasp !] npm warn deprecated [email protected]: Use your platform's nativ
[ Wasp !] npm warn ERESOLVE overriding peer dependency
[ Wasp !] npm warn While resolving: @vitest/[email protected]
[ Wasp !] npm warn Found: [email protected]
[ Wasp !] npm warn node_modules/vite
[ Wasp !] npm warn dev vite@"^4.3.9" from the root project
[ Wasp !] npm warn
[ Wasp !] npm warn Could not resolve dependency:
[ Wasp !] npm warn peerOptional vite@"^5.0.0" from @vitest/[email protected]
[ Wasp !] npm warn node_modules/@vitest/mocker
[ Wasp !] npm warn @vitest/mocker@"2.1.1" from [email protected]
[ Wasp !] npm warn node_modules/vitest
[ Wasp !] npm warn
[ Wasp !] npm warn Conflicting peer dependency: [email protected]
[ Wasp !] npm warn node_modules/vite
[ Wasp !] npm warn peerOptional vite@"^5.0.0" from @vitest/[email protected]
[ Wasp !] npm warn node_modules/@vitest/mocker
[ Wasp !] npm warn @vitest/mocker@"2.1.1" from [email protected]
[ Wasp !] npm warn node_modules/vitest
[ Wasp !] npm warn deprecated [email protected]: Use your platform's nativ
2 Replies
kapa.ai
kapa.ai3mo ago
Hi @abhinav3295. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, there is no specific information about the compatibility of Vitest with a specific version of Vite in the context of Wasp. However, Wasp does support testing web apps through Vitest as mentioned in the Wasp documentation (https://wasp-lang.dev/docs/project/testing#testing-your-react-app). The error you're encountering seems to be a dependency conflict between the versions of Vite required by your project and Vitest. It appears that @vitest/mocker is expecting Vite version ^5.0.0, but your project is using Vite version 4.5.3. You might need to update your Vite version to resolve this issue. However, before doing so, ensure that the newer version of Vite is compatible with Wasp and other dependencies in your project. If the issue persists, it would be best to reach out to the Wasp community or check the official Wasp GitHub repository for any similar issues or solutions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @abhinav3295, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos3mo ago
It seems that vitest wants a specific version of Vite, while Vite that comes with Wasp is older, and that is an issue. I would suggest using older version of vitest, or waiting for Wasp to update the version of Vite.
Want results from more Discord servers?
Add your server