Skip to content

How to implement cypress and vitest in the same project without type clashing #2058

Answered by ghiscoding
daribock asked this question in Q&A
Discussion options

You must be logged in to vote

I'm facing the exact same problem and it seems that the only approach I found to be working and not too annoying is to let Cypress win globally and then use import { expect, vi } from 'vitest'; so that Vitest uses its own expect interface instead of Chai (Cypress). This is the best I could find but it is not really what I want, I wish that I could use both Cypress and Vitest globally from any folders since in our structure we have Cypress tests (__e2e__/*.cy.ts) and Vitest (__tests__/*.spec.ts), I really hope that one day TypeScript would provide a way to override types by their file extension.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@AriPerkkio
Comment options

Answer selected by daribock
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants