Skip to content

Advice for encountering uncaught exceptions during test runsΒ #8

@alexfinnarn

Description

@alexfinnarn

During a test run, if Cypress encounters an unhandled exception, it fails the test run. Sometimes the exception relates to custom code, but sometimes it relates to third-party code and it might only happen intermittently.

Cypress provides some advice for handling these scenarios: https://docs.cypress.io/api/events/catalog-of-events#To-turn-off-all-uncaught-exception-handling

Cypress.on('uncaught:exception', (err, runnable) => {
  // returning false here prevents Cypress from
  // failing the test
  return false
})

You can add that to a describe() or it() block's scope or try to handle them more globally. What should the guidance be for encountering uncaught exceptions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions