-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Component tests] cy.stub doesn't work on Nextjs 12 with latest cypress #20008
Comments
Hi @FelipeLahti - please see the sinonjs documentation surrounding stubbing module exports for why your Closing since issues are reserved for bugs or feature requests and this is working as expected. |
@FelipeLahti Did you manage to fix the issue? We're observing the same for SPA created with Create React App and I am wondering if we missed something that is not directly mentioned in the article provided by @flotwig. In our case, we are trying to override |
I managed to workaround that by using adding the following
Just be aware that it will disable the new SWC compiler. @flotwig can you point me to an working example or where the stub implementation is wrong? |
Has anyone been able to use Next12 with the swc compiler? |
Still using the workaround above without the swc compiler. |
😿 aw - okay thanks for the reply! |
Current behavior
I created a completed new Nextjs application with cypress to do some component tests but I can seem to get the
cy.stub
to work.Desired behavior
I would expect that
stubbing would replace the return value from "myFunction".
Test code to reproduce
Reproducible example here: https://github.com/FelipeLahti/cypress-nextjs12-bug
Cypress Version
9.4.1
Other
No response
The text was updated successfully, but these errors were encountered: