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

afterAll inside a describe hides errors #6692

Closed
galenmaly opened this issue Jul 13, 2018 · 4 comments
Closed

afterAll inside a describe hides errors #6692

galenmaly opened this issue Jul 13, 2018 · 4 comments

Comments

@galenmaly
Copy link

🐛 Bug Report

Errors thrown in afterAll inside a describe can cause a test suite to fail silently.

This bug was previously reported under #3266 and fixed under #5884 - but the fix addresses errors in an afterAll at the top level, not inside a describe.

To Reproduce

describe('broken afterAll', () => {
  afterAll(() => {
    expect(1).toEqual(2);
  });
  it('should pass regardless.', () => {});
});

Expected behavior

The test suite should fail, like it does if the error were thrown in a top-level afterAll.

Link to repl or repo (highly encouraged)

https://repl.it/HAYG/1 (same repl as #3266 - thanks @gdborton)

As of writing repl.it is only running jest 22.1.2 whereas the fix for #3266 was released in 23.0.0. However the issue is present in the latest version of 23.4.1.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  Binaries:
    Node: 10.6.0 - /usr/local/bin/node
    npm: 6.1.0 - /usr/local/bin/npm
  npmPackages:
    jest: 23.4.1 => 23.4.1 
@SimenB
Copy link
Member

SimenB commented Jul 17, 2018

I wonder if this also is more sane with jest-circus. Can you try it out? #6695 (comment)

@galenmaly
Copy link
Author

This does seem to work correctly under jest-circus 23.4.1.

@SimenB
Copy link
Member

SimenB commented Aug 18, 2018

CLosing then, as circus will become the default and we're unlikely to fix errors with jasmine

@SimenB SimenB closed this as completed Aug 18, 2018
@ghost ghost mentioned this issue Jun 4, 2019
h4l added a commit to cambridge-collection/cudl-services that referenced this issue Mar 21, 2021
The default Jasmine-based runner is broken in this regard:
  jestjs/jest#6692
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants