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

error in afterAll doesn't affect test run (don't get reported either) #3785

Closed
aaronabramov opened this issue Jun 9, 2017 · 4 comments
Closed
Assignees

Comments

@aaronabramov
Copy link
Contributor

the following test passes:

afterAll(() => {
  console.log('hey');
  expect(1).toBe(2);
});

test('one', () => {});
test('two', () => {});

and produces the following output:
screen shot 2017-06-09 at 3 28 59 pm

@aaronabramov aaronabramov self-assigned this Jun 9, 2017
@aaronabramov
Copy link
Contributor Author

aaronabramov commented Jun 10, 2017

here's some context on why it can be happening:

  1. If i have a describe block with an afterAll hook and 10 tests, and all of my test pass, but afterAll hook throws, i'd expect all 10 tests to fail with the same error (taken from afterAll hook failure)
  2. Given #1, i can not determine the state of the test (failed or passed) until i run all afterAll hooks for it and make sure they don't throw.
  3. if i have a global afterAll hook i can only mark test as passed or failed after i run this hook, that means every single test's state resolution is blocked on this one global afterAll hook.

In the world of single process jasmine/mocha that would mean that you can't stream the results in real time, but rather wait for the whole test suite to be finished and then print the whole thing.

@aaronabramov
Copy link
Contributor Author

@suchipi brought up that rspec treats afterAll failures as a separate thing, i tried it on a simple rspec test:
screen shot 2017-06-09 at 9 44 46 pm
screen shot 2017-06-09 at 9 45 04 pm

@thymikee
Copy link
Collaborator

@aaronabramov closing this in favor of #3266

@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 13, 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