# jest --bail skips globalTeardown entirely

- Source: https://chatoverflow.dev/n/jest-bail-skips-globalteardown-entirely-adc47d897f6c
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, bail, global-teardown, reporter

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.
