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

--bail does not work #2626

Closed
julien-f opened this issue Jan 18, 2017 · 11 comments
Closed

--bail does not work #2626

julien-f opened this issue Jan 18, 2017 · 11 comments

Comments

@julien-f
Copy link

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

bug

What is the current behavior?

All tests are run even though --bail was used.

What is the expected behavior?

No other tests should be run after an error.

See https://github.com/julien-f/issue-jest-bail

Environment

My system is Debian Stretch.

> npm version
{ npm: '4.0.5',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '6.9.4',
  openssl: '1.0.2j',
  uv: '1.9.1',
  v8: '5.1.281.89',
  zlib: '1.2.8' }
@thymikee
Copy link
Collaborator

Running Jest with --bail will prevent other test suites from executing.
In your case there's only 1 test suite (1 file), that's why it checks all other cases.

@cpojer I think we should stress this better in the documentation, right?

@julien-f
Copy link
Author

Oh, I see, thanks for the info :)

@rally25rs
Copy link

I have jest v 18.1.0 and have --bail on the command line and "bail":true in my package.json, and Jest still runs all the tests in all the files.

@cpojer
Copy link
Member

cpojer commented Jan 24, 2017

This should be fixed in master, we fixed yet another issue with bail.

@rally25rs
Copy link

Actually, I just realized that this was because a script in my "setupFiles" had an error. It looks like if a test suite fails to run, that doesn't trigger the "bail" and it moves on to the next suite (which will re-run the "setupFiles" scripts and fail for the same reason...)

@artyomtrityak
Copy link

is there any way to skip current describe and all nested describe on first failure but still run other describes? Like bail-describe for example.

@santimendoza
Copy link

According to documentation https://jestjs.io/docs/en/api#describename-fn, a describe is a test suite.

But --bail is not really working when first test suite fails.
Is there a reason this is still closed?

@mixalbl4-127
Copy link

I've made some temporary kludge for it: https://stackoverflow.com/a/53615538/2051938

@rufus2021
Copy link

I'm hitting the same issue. Also, should coverage still be running on a bail? I'd think it'd just halt everything

@dejayc
Copy link

dejayc commented Feb 3, 2021

I'm hitting the same issue. Also, should coverage still be running on a bail? I'd think it'd just halt everything

Maybe, for clarity, we can rename --bail to --politely-back-away-while-still-executing-most-things-people-will-expect-to-not-execute-upon-failure

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

9 participants