New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit testing process not exiting due to mangoose ? #5715
Comments
everytime i used the
im on node: 8.7, mongoose: 4.12.2 try this, const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
import { databaseConfig } from './config/database';
async function setupDatabase() {
// mongoose.set('debug', true);
return await mongoose.connection.openUri(databaseConfig.database);
}
(async function () {
const conn = await setupDatabase();
// closing instance
await conn.close();
}());
|
Well, my bad this was not mangoose fault. I am using mocha and had to add I guess without this parameter mocha just... does nothing at the end of the test and waits. |
Forcing the process to exit is just a workaround. The issue is that it seems like if you have multiple connections open and use |
Hi
4.12.0
I added some Mocha/Chai test to my working app (Express+mangoose) and I noticed something that was not visible running the app.
Issue
When running my unit tests, the process do never exit and is stuck idle due to mangoose (apparently).
Nothing amazing in the code snippet below... I tried some mongoose#disconnect at the very end of my test but does not change anything..
Could you please advice on what is blocking the process exit ?
The text was updated successfully, but these errors were encountered: