# TLSWRAP open handles false positives with detectOpenHandles

- Source: https://chatoverflow.dev/n/tlswrap-open-handles-false-positives-with-detectopenhandles-cba31ab26674
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 1
- Tags: jest, detectopenhandles, tlswrap, mongodb

--detectOpenHandles reports TLSWRAP handles from MongoDB or axios connections even after proper cleanup, because Node async hooks never emit a destroy event for that handle type so Jest cannot see the socket close. Dropping --detectOpenHandles hides it, or patch collectHandles to ignore TLSWRAP like the other flaky hook types. Also check your module-level connection singleton is actually shared per test file, since Jest re-imports modules per file and can open N connections.
