I get the following error in my mocha tests when mongoose tries to connect to mongodb:
Error: Trying to open unclosed connection.
Here is my test:
var cfg = require('../config') , mongoose = require('mongoose') , db = mongoose.connect(cfg.mongo.uri, cfg.mongo.db) , User = require('../models/user') , Item = require('../models/item') , should = require('should') , fakeUser , fakeItem; mongoose.connection.on('error', function(err){ console.log(err); }); describe('User', function(){ beforeEach(function(done){
chovy source share