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

4.12.1 Regression: after() block causes errors in before() to be hidden #9162

Closed
kpittman-securus opened this issue Nov 10, 2020 · 3 comments · Fixed by #9527
Closed

4.12.1 Regression: after() block causes errors in before() to be hidden #9162

kpittman-securus opened this issue Nov 10, 2020 · 3 comments · Fixed by #9527
Labels
type: regression A bug that didn't appear until a specific Cy version release v4.12.1 🐛 Issue present since 4.12.1

Comments

@kpittman-securus
Copy link

kpittman-securus commented Nov 10, 2020

Current behavior

If I have a before() that threw an error, and anything (or even nothing) inside an after() block, the test runner gets hung up and will not display the error from the before().

This behavior only occurs on tests with multiple it blocks.

Desired behavior

Should behave the same as when I remove the after()

  • display the error and exit cleanly.

Test code to reproduce

describe("A spec with an after() block has an error in a before() block", () => {
  before(() => {
    cy.request("https://httpstat.us/404");
  });
  after(() => {
    cy.log("after"); // if you remove these 3 lines - the entire after() block, not just the cy.log - the stack trace is shown correctly
  });
  it("has a test", () => {
    expect(true).to.be.true;
  });
  it("has another test", () => {
    expect(true).to.be.true;
  });
});

image

Versions

At least 4.12.1 through 5.6.0

@jennifer-shehane
Copy link
Member

This is a regression introduced in 4.12.1. This must have been introduced in #8113, since there were very few commits in this release and that one involves test hooks.

describe('hangs when error in a before() block', () => {
  before(() => {
    expect(true).to.be.false
  })
  after(() => {})
  it('has a test')
  it('has another test')
})

4.12.0

Screen Shot 2020-11-16 at 11 35 24 AM

4.12.1

Screen Shot 2020-11-16 at 11 37 04 AM

@jennifer-shehane jennifer-shehane changed the title after() block causes errors in before() to be hidden 4.12.1 Regression: after() block causes errors in before() to be hidden Nov 16, 2020
@jennifer-shehane jennifer-shehane added type: regression A bug that didn't appear until a specific Cy version release v4.12.1 🐛 Issue present since 4.12.1 labels Nov 16, 2020
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Nov 16, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Dec 4, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 7, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 7, 2020

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

Released in 6.1.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: regression A bug that didn't appear until a specific Cy version release v4.12.1 🐛 Issue present since 4.12.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants