elliotf / mocha-mongoose

test helpers for using mongodb with mocha
MIT License
107 stars 21 forks source link

Added a function to close the database in the after hook #16

Closed seawatts closed 9 years ago

seawatts commented 9 years ago

The reason for this PR is because I was having some issues where mocha would not exit cleanly because there were still connections open to the database. By calling close on the database it resolves this issue and mocha can exit cleanly.

You can see here https://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html#mongoclient-connect that they do the same thing after they open a connection.

I wasn't sure how to even test this, so I didn't add any tests sorry.

elliotf commented 9 years ago

Thank you for the PR!

Yeah, it would be hard to test it in any meaningful way. This looks good, and I hope it helps!

elliotf commented 9 years ago

v1.1.1 published with this fix

seawatts commented 9 years ago

Woot! :tada: Thanks :+1: