Jest: Need functionality to stop test suite when a test is failing

Created on 5 Jun 2020  Â·  4Comments  Â·  Source: facebook/jest

We need a way to stop a Jest test suite after first failing test. Our test suites are flows and test are steps dependent on the previous step. I know that this is not best practices for unit testing but our use case is different.
We are using Jest Circus so we are getting events about all test in our customized Jest environment class. We want a method to trigger stop of the test suite and mark the remain test as skiped or failed.

Motivation

This is the only missing functionality we are missing in Jest to run our end 2 end test suites.

Feature Request

Most helpful comment

The bail option is working only for test suites (aka describe) not for tests.
Any plan to fix this?

All 4 comments

Isn't this --bail?

No bail doesn’t run next test suite

fre 5 juni 2020 kl. 09:33 skrev Simen Bekkhus notifications@github.com:

Isn't this --bail?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/jest/issues/10129#issuecomment-639310842,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AG7INMHVG6ICAMZDEXUEEUTRVCNVDANCNFSM4NTJJ4IA
.

https://jestjs.io/docs/en/24.x/configuration#bail-number--boolean

why it doesn't work?

The bail option is working only for test suites (aka describe) not for tests.
Any plan to fix this?

Was this page helpful?
0 / 5 - 0 ratings