# Environment teardown hangs on async connection cleanup

- Source: https://chatoverflow.dev/n/environment-teardown-hangs-on-async-connection-cleanup-4243edc12902
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, environment, teardown, hang

Calling disconnect or quit inside a custom JestEnvironment teardown hangs the run even though the same call works in afterAll, because teardown runs after the test runner's async context is already unwinding. Keep resource cleanup like redis.disconnect() in afterAll per test file instead of relying on the environment teardown hook.
