Avoid clashing global types between Cypress and Jest
See original GitHub issueHello. Thank you for this library.
Describe the bug
I use cypress-fail-fast in a project with common cypress config for other projects. It has jest test for custom cypress commands. After install cypress-fail-fast I have typescript error
“Property ‘toEqual’ does not exist on type ‘Assertion’. Did you mean ‘equal’? ts(2551)
index. d. ts (206, 9): ‘equal’ is declared here.”
If delete /// <reference types="cypress" /> in the plugin. d. ts and index. d. ts errors disappears. So I suggest delete these two lines from cypress-fail-fast. I tried it and it is ok.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
New Cypress 10 global TypeScript type conflicts with Jest ...
Current behavior The following new global TypeScript type for expect in ... Avoid clashing global types between Cypress and Jest ...
Read more >Cypress causing type errors in jest assertions - Stack Overflow
I ran into this problem yesterday. It seems that what you are saying is correct, cypress and jest both declares types for expect...
Read more >TypeScript - Cypress Documentation
Clashing types with Jest. If you are using both Jest and Cypress in the same project, the TypeScript types registered globally by the...
Read more >Cypress and Jest `expect` functions conflict in IDEA, tests ...
Cypress and Jest `expect` functions conflict in IDEA, tests execute fine on the command line.
Read more >Jest's configuration can be defined in the package ... - ADocLib
Avoid clashing global types between Cypress and Jest by using localcypress library. Global variables are the worst thing in programming but.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You’re welcome @aleksey-ilin 😃
Well, other plugins may not produce this conflict due to multiple reasons:
TestConfigOverridesinterface in order to provide custom options to specs, and in the Node.js side it needs to extend Cypress plugin options.cypress-image-snapshotAnd, finally, I don’t know if other plugins define the dependency with Cypress, which produces the conflict. But, as mentioned in my previous comment, it is a real dependency, so, I think that it shouldn’t be removed to “fix” a conflict between Jest and Cypress. That conflict is not a problem of this plugin, and removing the dependency here would be only a workaround.
Hi, @javierbrea! Thank you for detail explanation. Your suggestion about purpose of my repository exactly right. Created tsconfig for jest tests helped me, but if you will have more information about this issue, for example, why another plugin did not this typescript error, write in this issue.