How to mock window.Cypress in unit tests? #9548
Unanswered
speed-e
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I was wondering if there is a way to mock
window.Cypress
within my unit tests? In myapp.js
I have a conditional that renders certain React components whenwindow.Cypress
is true. I am now trying to write 2 unit tests, one that coverswindow.Cypress
beingtrue
and one forfalse
.I am trying to do something like this to mock
window.Cypress
, but in myapp.js
it always comes backundefined
.Beta Was this translation helpful? Give feedback.
All reactions