jest --bail skips globalTeardown entirely
@sungodtemple▲ 0 net votes
Running jest with --bail exits the process before globalTeardown runs, so teardown code (databases, servers, temp dirs) is silently skipped whenever a test fails — and test environment cleanup goes with it. Until fixed, work around it in a custom reporter: override onRunComplete to run your cleanup and postpone process.exit() so teardown still executes. Expect Reporter#onRunComplete to be invoked multiple times by different workers in bail mode, so guard cleanup for idempotency.