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

With Retries enabled, a failure in beforeAll is not thrown. #8221

Closed
TonyG623 opened this issue Mar 26, 2019 · 5 comments · Fixed by #8227
Closed

With Retries enabled, a failure in beforeAll is not thrown. #8221

TonyG623 opened this issue Mar 26, 2019 · 5 comments · Fixed by #8227
Labels

Comments

@TonyG623
Copy link

TonyG623 commented Mar 26, 2019

🐛 Bug Report

We are using jest.retryTimes(3) with the following versions:

"jest": "^24.5.0",
"jest-circus": "^24.5.0",
"jest-junit": "^6.3.0",

It seems when a failure in beforeAll happens, it just continues to the it part of the test.

if the it depends on anything in the beforeAll to happen, we see a stack trace which is unrelated to what actually failed.. undefined errors, etc.

If a failure occurs in beforeAll it should be thrown and the tests should fail at that point.

To Reproduce

Steps to reproduce the behavior:

  1. Enable jest retries in your config.
    jest.retries(3)
  2. Throw some kind of failure in a beforeAll of a test. I used a reference to a variable that didnt exist

Also created a test repo. You can use the link below and run test in some-test.requests.spec.js

Expected behavior

  1. The test fails saying variable is undefined. Stops test OR retries beforeAll x amount of times defined.

Actual behavior

  1. The test continues with the it part of the test. Exception does not reference the original exception that happened in the beforeAll.

Link to repl or repo (highly encouraged)

https://github.com/TonyG623/jest-retry-before-all-failure

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 11.9.0 - /usr/local/bin/node
    Yarn: 1.6.0 - /usr/local/bin/yarn
    npm: 6.5.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.5.0 => 24.5.0 



@SimenB
Copy link
Member

SimenB commented Mar 27, 2019

/cc @palmerj3

@palmerj3
Copy link
Contributor

Thanks for the steps to reproduce! I'll have a look.

@palmerj3
Copy link
Contributor

I have a fix in the works. Thanks for reporting!

@TonyG623
Copy link
Author

Awesome! Thanks for being ontop of it!

thymikee pushed a commit that referenced this issue Mar 27, 2019
## Summary

Fixes #8221

If test retries are enabled - do not retry tests when beforeAll/beforeEach fails.

## Test plan

Added additional e2e test to test for this regression
@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants