-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
jest not exiting on successful completion of test suite #3602
Comments
The problem is that your test is likely setting up some intervals, network connections or db connections and you aren't shutting them down properly after your tests. Jest doesn't know how to clean those up for you. |
I checked for open processes and the only thing I get back is: Is there another way to look for open processes that I'm not aware of? I use the |
Seems like whatever you do in afterEach isn't doing enough. |
Sorry for opening this I feel so stupid now. You were absolutely right. I was only dropping the specific collection to the database. It was dropping the database and closing the server connection but the connection to ps | grep node At any rate this was what I was missing: // Connection to Mongo killed.
await mongoose.disconnect(); Again sorry for opening this issue. |
This is not working for me, I am using mongoose 5.0.2 afterAll(async () => {
await mongoose.connection.dropDatabase('test')
mongoose.connection.close()
}) or afterAll(async () => {
await mongoose.connection.dropDatabase('test')
await mongoose.disconnect()
}) or afterAll((done) => {
mongoose.connection.dropDatabase('test').then(()=>{
mongoose.connection.close()
})
done()
}) or afterAll((done) => {
mongoose.connection.dropDatabase('test').then(()=>{
mongoose.connection.close()
done()
})
}) Please help, thanks in advance |
Have you looked at some of the other comments left on the StackO post? This should really be something you ask on StackO as it probably is not an issue related to https://stackoverflow.com/questions/44036189/jest-not-terminating-after-tests-complete-successfully |
FWIW, jest has @WangHansen your issue is that you just close the connection, not the db itself, see 513a6fb And as mentioned above - this is very much an SO question, not something for this issue tracker. |
@WangHansen have you figure it out? |
@SimenB, but db doesn't have |
For those seeing this just now: you can use |
@candu Mind giving a couple examples of how one might do that, given a |
Dropping a note that |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
jest
does not exit after test suite completes successfully.Repository
Issue began in the following repository:
Repository I made for looking at the issue and troubleshooting it:
What is the expected behavior?
When running
jest --config jest.config.json
upon successful completion of the test suite I would expect to see Done in X amount of seconds.I've search StackO & the issue tracker. Taken the advice put forth in #997 for
unmocking
the modules; but issue still persists. I've removed node_modules and reinstalled, ran--no-cache
, followed the guidelines on the Troubleshooting page on thejest
website but to no avail.Tech Info
Jest Config
Update
I forgot to include the original post I opened on StackO yesterday. It is pertaining to the code from the first repository.
http://stackoverflow.com/questions/44036189/jest-not-terminating-after-tests-complete-successfully
The text was updated successfully, but these errors were encountered: