When running NodeUnit tests and your tests are connected to Mongo DB, the tests do not end and it just hangs there. The fix is to close the connection on NodeUnit's tearDown function.
Example below is using Mongoose' disconnect function to close the connection after NodeUnit tests are done:
Example below is using Mongoose' disconnect function to close the connection after NodeUnit tests are done:
var mongoose = require('mongoose'); exports.tearDown = function(ok){ mongoose.disconnect(function(err){ if(err) { console.error(err); return; } }); ok(); };
