How to implement cypress and vitest in the same project without type clashing #2058
-
I have conflict using vitest and cypress in the same project. I already tried the example from cypress on how to implement cypress and jest in the same project without type clashingbut this didn't work. So I am helpless right now. :( I also asked for help in discord. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I would suggest to store all cypress related files (tests, configs, utils...) within one directory and create a separate
Another approach would be to use tsconfig project reference, where you have multiple tsconfig files on root level. Example: |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I would vote for - "cypress or any other E2E toolset should live his own life - it has no relation to the source code rather then it's artifact. So remove it from main project - move to separate repository or add it as a mono repo package"
|
Beta Was this translation helpful? Give feedback.
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 ownexpect
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.