Jest test hanging
When running integration tests that connect to a docker-based db, it seems like the connection stays alive, thus making my tests hang forever. They all run and pass successfully, but then the process never ends. If I pass
--forceExit
to jest, it works properly, but this seems like a bandaid. What is the recommended way to deal with this?
I wasn't able to find a good way to manually close the connection in a tear down step4 Replies
It might be worth taking a look at how drizzle run tests in docker https://github.com/drizzle-team/drizzle-orm/blob/main/integration-tests/tests/pg.test.ts
GitHub
drizzle-orm/integration-tests/tests/pg.test.ts at main · drizzle-te...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅 - drizzle-team/drizzle-orm
For example, that's pg
This was instructive. thanks. In prisma, i didnt need to do this step. perhaps it was able to close all connections automatically
i was using testcontainers. looks like just calling container.stop() during teardown works fine, but an annoying extra step nonetheless
i suppose the feature request would be:
kill connection upon process exit (For graceful exits)
is this even possible?
Remember that drizzle doesn't manage your connection, you give the driver already instantiated