I am working on a Node.JS app and writing unit tests, which are testing database operations.

Since I wanted to TEST, I setup a new MongoDB connection for an extra test database.

When I ran the test I could see in Test Explorer that the test did not stop running, even after calling done(); (this is Mocha).

After fiddling around thinking it was about the asynchronous model I went in the callstack after in “done”. In the end I came out at some module called “MongoReply”. Seems like Mongo wants to stay open! Did not know Mongo keeps its process like that. So a tip: always close your DB’s after tests!