These are chat archives for Automattic/mongoose

Sep 2015
Benjamin Montgomery
Sep 07 2015 13:16
I’m having an issue with mongoose and testing using mocha. Everytime I hit mongoose.connect I get the “Trying to open unclosed connection” error. I haven’t connected mongoose prior to this call. I’ve also checked mongoose.connection.readyState at each test and the value is always 1. Any thoughts on how to debug this?
Benjamin Montgomery
Sep 07 2015 19:30
Using Mocha to test a module that uses mongoose is a pain. Problem was the parallel execution of tests in Mocha.
Joseph Thibeault
Sep 07 2015 19:48
Mocha has a asynchronous callback: it('should test stuff', function(done) { ... });
call done() in the callback of your async function to complete the test. Other tests won't execute until the previous ones finish.