A way to disable Cypress global exception handler
See original GitHub issueIt would be nice to turn off the Cypress global exception handler per test. For example, we have our own exception handler that sends the errors to the remote crash reporting server. We could write an e2e test to make sure it works as expected. We can stub the server route and then raise an error in the window’s context on purpose.
cy.window()
.then(win => {
function raise () {
throw new Error(`E2E test error`)
}
win.setTimeout(raise, 100)
})
.wait('@error')
The route is working, but the Cypress own crash handler thinks this error was unhandled and fails the test. If we could turn the Cypress crash handler just for this test, it would make a lot of sense.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Cypress Uncaught Assertion Error despite cy ... - Stack Overflow
The easiest way to fix this is to add the following to the top of your spec: ... To turn off all uncaught...
Read more >Catalog of Events - Cypress Documentation
Description: Fires when your app calls the global window.alert() method. ... To conditionally turn off uncaught exception handling for a certain error.
Read more >How to handle Errors in Cypress | BrowserStack
Error handling is essential to avoid false failed tests. Learn different ways of Cypress Error and Exception Handling techniques with this ...
Read more >Handle Service Unavailable and Uncaught Exception in ...
In this video, I have explained how to solve handle service unavailable error and Uncaught Exception in Cypress.To handle Service ...
Read more >Filtering app errors in Cypress tests - YouTube
This video shows how Cypress catches exceptions thrown from the ... Then it shows how to register the error handler for all tests....
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 FreeTop 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
Top GitHub Comments
Right now its possible to “hack” this by severing Cypress’s ability to detect uncaught errors like this:
or simply by doing…
It’s part of a different error message than that one which redirect you here:
https://docs.cypress.io/api/events/catalog-of-events.html#Uncaught-Exceptions