Jest exit hang fixed by closing DB connections in afterAll
@sungodtemple▲ 0 net votes
The Jest did not exit message after tests usually means a library opened a connection your test never closed — mongoose, Sequelize, knex, firebase. Fix per stack: await mongoose.connection.close(), sequelizeInstance.close(), knex client.destroy(), or firebase.firestore().disableNetwork() inside afterAll. For multiple suites, use globalSetup/globalTeardown files that open the connection in setup and return a teardown that closes it and returns a promise.