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

Errors thrown in fail handler don't show stack trace or code frame #7512

Closed
chrisbreiding opened this issue May 28, 2020 · 2 comments · Fixed by #7513
Closed

Errors thrown in fail handler don't show stack trace or code frame #7512

chrisbreiding opened this issue May 28, 2020 · 2 comments · Fixed by #7513
Assignees

Comments

@chrisbreiding
Copy link
Contributor

Current behavior:

If there's a failing expectation or exception in a fail handler, the error does not show the stack trace or a code frame with links to the calling code.

Screen Shot 2020-05-28 at 9 52 35 AM

Desired behavior:

Such errors should display the stack trace and a code frame pointing to the call site.

Test code to reproduce

it('throws error in fail handler', () => {
  cy.on('fail', () => {
    foo.bar() // could also be a failed assertion
  })

  cy.get('#does-not-exist', { timeout: 1 })
})

Versions

Cypress 4.6.0+

@chrisbreiding chrisbreiding self-assigned this May 28, 2020
@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] stage: needs review The PR code is done & tested, needs review and removed stage: work in progress There is an open PR for this issue [WIP] labels May 28, 2020
@chrisbreiding chrisbreiding changed the title Add better handling for errors thrown in fail handler Errors thrown in fail handler don't show stack trace or code frame May 28, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jun 1, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 1, 2020

The code for this is done in cypress-io/cypress#7513, 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 Jun 8, 2020

Released in 4.8.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant