Jest did not exit one second after the test run has completed using express

前端 未结 5 1831
孤独总比滥情好
孤独总比滥情好 2021-02-05 14:24

I\'m using JEST for unit testing my express routes.

While running the yarn test all my test case are getting passed, but I\'m getting an error



        
5条回答
  •  轮回少年
    2021-02-05 15:17

    My problem was solved by this code:

    beforeAll(done => {
      done()
    })
    
    afterAll(done => {
      // Closing the DB connection allows Jest to exit successfully.
      mongoose.connection.close()
      done()
    })
    

提交回复
热议问题