-
Notifications
You must be signed in to change notification settings - Fork 638
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
Having trouble running Jest, unhandled Promises #1015
Comments
Objection doesn't hold on to any promises of run anything in the background. The problem is somewhere else I'm afraid. |
Are you creating multiple instances of the |
@koskimas I am not creating multiple instances, atm it should just be a single sqlite memory instance. |
@ncrmro You can't just call const { promisify } = require('util')
const disconnect = promisify(this.knex.destroy)
(async() => {
await this.knex.destroy()
})() |
or, as I do in my jest suites: await promisify(this.knex.destroy)() |
@heisian this is very insightful been learning more and more about how async and promises work each day. Will let you guys know when/if resolved. |
Actually I might be wrong - according to the knex docs:
Though I do know for a fact wrapping it in |
@heisian tried
No luck, do you have any example somewhere with knex, objection and jest working? Maybe at least versions and snippits? Thinking maybe it's sqlite. I've t ried various combos of async/await and without. this.knex.destroy(cb) never fires the callback either. if I console.log(this.knex) it pops up. Might need to move to knex and reference issue here. |
I do see somethings coming out of objection though?
|
Seeing this #534 |
cynicaloptimist/improved-initiative#250 Links to this
|
Looks like bad timing apologies.. Stiill wonder about that lingering objection promise but we shall see. Going to just have the server started externally. |
Hello, |
When trying to work with the DB in the tests we were getting ``` Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue. ``` Googling led us to [Having trouble running Jest, unhandled Promises](Vincit/objection.js#1015) and [Need to explicit destroy knex in order to stop the script](Vincit/objection.js#534). The second issue included a comment that setting the pool min size to 0 and idleTimeoutMillis to 500 would solve the problem. We tried it and it worked!
When trying to work with the DB in the tests we were getting ``` Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue. ``` Googling led us to [Having trouble running Jest, unhandled Promises](Vincit/objection.js#1015) and [Need to explicit destroy knex in order to stop the script](Vincit/objection.js#534). The second issue included a comment that setting the pool min size to 0 and idleTimeoutMillis to 500 would solve the problem. We tried it and it worked!
When trying to work with the DB in the tests we were getting ``` Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue. ``` Googling led us to [Having trouble running Jest, unhandled Promises](Vincit/objection.js#1015) and [Need to explicit destroy knex in order to stop the script](Vincit/objection.js#534). The second issue included a comment that setting the pool min size to 0 and idleTimeoutMillis to 500 would solve the problem. We tried it and it worked!
When trying to work with the DB in the tests we were getting ``` Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue. ``` Googling led us to [Having trouble running Jest, unhandled Promises](Vincit/objection.js#1015) and [Need to explicit destroy knex in order to stop the script](Vincit/objection.js#534). The second issue included a comment that setting the pool min size to 0 and idleTimeoutMillis to 500 would solve the problem. We tried it and it worked!
Awesome project!
Have a database class that has public connect and close methods. Which Jest uses before and afterAll to cleanly connect and disconnect during tests.
Looks like Objection might still be running. Screen shot of code below. Any ideas on how to close this. Log shows
Code base can be found here
Thanks again for the awesome tool
The text was updated successfully, but these errors were encountered: