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

After hooks fired in an inconsistent order. #3268

Closed
gdborton opened this issue Apr 8, 2017 · 1 comment
Closed

After hooks fired in an inconsistent order. #3268

gdborton opened this issue Apr 8, 2017 · 1 comment

Comments

@gdborton
Copy link
Contributor

gdborton commented Apr 8, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

After hooks are run in an inconsistent order. afterEach hooks are run in reverse order, while afterAll hooks are run in the same order that they're added.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

See the output from the repl - https://repl.it/HAwZ

What is the expected behavior?

Personally I think that both afterEach and afterAll should be running in the same order that they're originally added, but it doesn't matter which order they're run in to me as long as they're consistent.

I see the same issue in Jasmine 2.5 in case you want to stay consistent -
jasmine/jasmine#1311

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

❯ node --version; npm --version; jest --version
v4.6.2
2.15.11
v19.0.0
gdborton added a commit to gdborton/jest that referenced this issue Apr 10, 2017
…Each.

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - jestjs#3268
gdborton added a commit to gdborton/jest that referenced this issue Apr 10, 2017
…Each.

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - jestjs#3268
gdborton added a commit to gdborton/jest that referenced this issue Apr 10, 2017
…Each.

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - jestjs#3268
cpojer pushed a commit that referenced this issue Apr 12, 2017
…Each. (#3275)

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - #3268
@cpojer cpojer closed this as completed Apr 12, 2017
skovhus pushed a commit to skovhus/jest that referenced this issue Apr 29, 2017
…Each. (jestjs#3275)

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - jestjs#3268
tushardhole pushed a commit to tushardhole/jest that referenced this issue Aug 21, 2017
…Each. (jestjs#3275)

It was discovered that afterAll hooks run in the same order that you add them,
while afterEach hooks were running in reverse order.  This commit makes their
order consistent, and adds regression tests.

Relevant issue - jestjs#3268
@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