Skip to content
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

Potentially catch global onunhandledrejection as errors? #243

Closed
brian-mann opened this issue Sep 26, 2016 · 5 comments
Closed

Potentially catch global onunhandledrejection as errors? #243

brian-mann opened this issue Sep 26, 2016 · 5 comments
Labels
topic: unhandled exceptions ⚠️ Issues involving unhandled or uncaught exception handling type: question

Comments

@brian-mann
Copy link
Member

Currently Cypress taps into window.onerror for failing tests which have script errors.

But we don't tap into onunhandledrejection events. I believe we should, but enable this to be configurable.

API Idea:

Cypress.Errors.listenForUncaughtExceptions(false)
Cypress.Errors.listenForUnhandledRejections(false)
@brian-mann brian-mann changed the title Potentially catch global onunhandledrejection as errors Potentially catch global onunhandledrejection as errors? Sep 26, 2016
@bahmutov
Copy link
Contributor

bahmutov commented Oct 3, 2016

It 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.

@brian-mann
Copy link
Member Author

ref #254

@cezarsmpio
Copy link

Any progress?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 1, 2021

The code for this is done in cypress-io/cypress#14826, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 5, 2021

Released in 7.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: unhandled exceptions ⚠️ Issues involving unhandled or uncaught exception handling type: question
Projects
None yet
Development

No branches or pull requests

5 participants