-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
failing beforeAll() causes even passing tests in the scope to fail #6695
Comments
@aaronabramov have we changed the behaviour here for circus? Bailing after a failing lifecycle hook makes sense to me |
yes! this was a bug in jasmine (or a feature). We changed this behavior in jest-circus. |
I would like to add to this a request for named hooks. The test is marked as a failure and not run, but named hooks (especially when the hooks reside outside of the test file) would aid in debugging. |
@alycda feel free to open up a separate issue for that 🙂 Closing this as the behavior is fixed in jest-circus |
It doesn't seem to be fixed in latest Jest (v23.6.0). So it's fixed for what users exactly? Facebook internal? |
See the comment above: #6695 (comment) Install circus (which will become the default in Jest at some point) and you should be good. Also see #7198 |
Thanks I'll follow. Still why then it's not set as default? Are there any other issues we should be aware of? Is |
You can follow #6295 for state of making it the default. |
this solves the issue of seeing two failures for each test in test output when beforeAll fails jestjs/jest#6695
this solves the issue of seeing two failures for each test in test output when beforeAll fails jestjs/jest#6695
Here's the command I ran:
Am I missing a configuration value somewhere? |
To my eyes this just looks like an issue with the reporting. We should probably avoid printing the individual tests if |
I've seen a similar issue with reporting. It's hard to disentangle from proprietary code, but what happens is that a Happy to see if the .todo issue reproduces once this is fixed. |
@SimenB the issue seems to be only partially fixed in circus since nested hooks are still being executed. |
@SimenB Should we create a separate issue for this? Or was the intention to re-open this to continue the work in this one? |
Sure, a new issue about the state today and what we want the end state to be makes sense to me |
Is it a duplicate of #2713? |
@SimenB: my comment above describes the current state as of |
Still not working as expected... Not via throwing an error or calling |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Definitely not stale, still see this issue in latest jest. |
Undigging topic - imo. test suite should interrupt tests execution with appropriate message when one of hooks will fail or timeout ( |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Unstale |
As a present for this issue's 5th birthday, I would like to ask a maintainer to reopen #2713, because throwing from It's sad that 3rd party packages (now with tens of thousands of weekly downloads) had to be developed to work around this problem: |
It seems this framework is totally abandonned... RIP! |
🐛 Bug Report
I'm looking for the best practice for aborting a
describe
block if the test setup fails. For example, when testing an API, if authenticating fails, it's pointless to run any other tests.As suggested in the issue template, I searched StackOverflow first, where I found this incomplete answer, advising to place the initialization code in a
beforeAll
block. Hence, raising the issue here becausebeforeAll
beforeAll
block fails, tests in thatdescribe
block are still run, and they fail, even if otherwise they would pass!To Reproduce
Expected behavior
Jest should report that the
beforeAll()
failed, and bail thedescribe
scope without executing further tests in it. If it's somehow intended behavior that all tests should still be executed, and still marked as failed (which I find odd), this should be documented underbeforeAll
and in the Setup and Teardown guide. Other tests in the file, outside of the failing block, should still be executed.Link to repl or repo (highly encouraged)
https://repl.it/@DanDascalescu/beforeAll-failure-should-bail-the-test
Run
npx envinfo --preset jest
System: OS: Linux 4.15 Ubuntu 16.04.4 LTS (Xenial Xerus) CPU: x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz Binaries: Node: 10.5.0 - /usr/local/bin/node Yarn: 1.7.0 - /usr/bin/yarn npm: 6.2.0 - /usr/local/bin/npm npmPackages: jest: ^23.4.1 => 23.4.1
See also
#6527
The text was updated successfully, but these errors were encountered: