-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Clear and concise description of the problem
Depending on the kind of tests we run, it can be interesting to have a fail-fast feature and exit as soon as a test is failing.
I'm not the only one needing such feature apparently: #964
Jest has bail for this purpose.
Suggested solution
As Vitest tries to smooth the transition from Jest, I think the bail option is a sensible name.
But Jest implementation is incomplete/weird, it's only skipping the next test suites (describe blocks), but it continues to run the other tests within the same test suite.
I think the default should be to bail by test case and not by test suite.
# Skip all the subsequent tests after n test failures (default 1)
--bail <n>
I'm not sure what could be the API if we want to deal with both test cases and test suites, maybe adding a --bail-scope <test|suite> (default test)? 🤔
Alternative
No response
Additional context
Here are related issues about it:
- Ability to skip rest test cases if one fails jestjs/jest#8387
- Jest should fail fast and exit early (change request for --bail) jestjs/jest#6527
- Bug: --bail flag does not bail jestjs/jest#2867
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable