DEV Community

Discussion on: Unit testing NestJS with mongo in memory...

Collapse
 
skuarchdevelop profile image
Skuarch

thanks for your article it really help me

when jest doesn't finish the execution try to use this in afterAll

afterAll(async () => {
await closeInMongodConnection();
mongoose.disconnect();
mongoose.connection.close();
});

Collapse
 
bassochette profile image
Julien Prugne • Edited

I'll try to update the post and sample code on github soon :)
Thanks for your help.
@deejoe79 offered a similar solution in the shutdown function helper.