Open njmaeff opened 3 years ago
Imo if beforeAll
hook fail it should skip all related tests and afterAll
hook should be run in any case (to ensure clean up is done, because beforeAll
hook may initialize something partially)
@fider-apptimia The current behaviour for jest circus is to mark the test as error when a beforeAll hook fails. The test will not run but the rest of the beforeAll, afterEach, and afterAll hooks will still run. I feel like once the first beforeAll fails, the rest of the beforeAll hooks should skip and then afterAll hooks immediately run. There is an open issue to fix this in the jest jasmine runner. I didn't see any issue specifically related to circus for this behaviour.
@njmaeff imo issue here is that test
s will be executed even if beforeAll
throw.
Tests should definitely not run if before*
fails. Whether or not after*
should run is probably a separate discussion
afterEach()
is also run in case beforeAll()
fails. Is that a separate issue?
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.
Stale? Has this been fixed. I think this is still an issue and should be fixed. I think @SimenB's comment summarized it perfectly:
Tests should definitely not run if before fails. Whether or not after should run is probably a separate discussion
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.
Still not fixed as far as I'm aware of so we should keep it open.
I noticed that if I throw in beforeAll
I still see the circus events for test_start
, test_started
& test_fn_start
which i find strange since they occur after the hook_failure
event, and I confirmed that the test function itself does not actually run.
🐛 Bug Report
When you have a failing
beforeAll
hook, all remainingbeforeAll
hooks will still run. Contrast that tobeforeEach
which after failing will skip the rest of thebeforeEach
hooks and skip the test.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I think after the first beforeAll failure, every other beforeAll hook and child test should be skipped / failed.
Link to repl or repo (highly encouraged)
envinfo