So I'm using jest
to test my node.js application and the tests finish fine but I'm getting a message from jest about open handles. Any insights?
jest --detectOpenHandles
PASS src/libs/user/tests/user_model_test.js PASS src/tests/app_test.js PASS src/libs/user/tests/user_service_test.js
Test Suites: 3 passed, 3 total Tests: 14 passed, 14 total Snapshots: 0 total Time: 7.209s Ran all test suites.
Jest has detected the following 4 open handles potentially keeping Jest from exiting:
● PROMISE
2 | // we use a test database for testing 3 | var mongoDB = 'mongodb://localhost/my_db_conn'; > 4 | mongoose.connect(mongoDB); | ^ 5 | const User = require('../user_model'); 6 | 7 | describe("User model test", () => { at NativeConnection.Object.<anonymous>.Connection.openUri (node_modules/mongoose/lib/connection.js:424:19) at Mongoose.Object.<anonymous>.Mongoose.connect (node_modules/mongoose/lib/index.js:208:15) at Object.<anonymous> (src/libs/user/__tests__/user_model_test.js:4:10)
● PROMISE
8 | }); 9 | > 10 | module.exports = mongoose.model("User", UserSchema); | ^ at Function.init (node_modules/mongoose/lib/model.js:962:16) at Mongoose.Object.<anonymous>.Mongoose.model (node_modules/mongoose/lib/index.js:392:11) at Object.<anonymous> (src/libs/user/user_model.js:10:27) at Object.<anonymous> (src/libs/user/__tests__/user_model_test.js:5:14)
● PROMISE
8 | }); 9 | > 10 | module.exports = mongoose.model("User", UserSchema); | ^ at Function.init (node_modules/mongoose/lib/model.js:962:16) at Mongoose.Object.<anonymous>.Mongoose.model (node_modules/mongoose/lib/index.js:392:11) at Object.<anonymous> (src/libs/user/user_model.js:10:27) at Object.<anonymous> (src/libs/user/index.js:1:41)
● PROMISE
3 | var mongoose = require('mongoose'); 4 | var mongoDB = 'mongodb://localhost/my_db_conn'; > 5 | mongoose.connect(mongoDB); | ^ 6 | 7 | describe('App test', () => { 8 | it('has a module', () => { at NativeConnection.Object.<anonymous>.Connection.openUri (node_modules/mongoose/lib/connection.js:424:19) at Mongoose.Object.<anonymous>.Mongoose.connect (node_modules/mongoose/lib/index.js:208:15) at Object.<anonymous> (src/__tests__/app_test.js:5:10)