question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sequelize with postgres leaves jest hanging after all tests executed

See original GitHub issue

Hello, I have made a sscee for this issue:

  1. clone the following repo: https://github.com/LaurentVB/sequelize-hanging-test
  2. npm install
  3. setup an empty postgresql DB named ‘test’, accessible by ‘root’ without password
  4. npm test

What do you expect to happen?

The test executes and the prompt returns.

What is actually happening?

After all tests pass, the execution of jest hangs until it’s killed with CTRL+C. The same test with an embedded in-memory sqlite DB behaves as expected.

Dialect: postgres Sequelize version: 3.24.6

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
julienvincentcommented, Aug 10, 2017

This is not working anymore. Using latest version of jest and sequelize, jest still hangs after calling sequelize.close()

11reactions
janmeiercommented, Oct 27, 2016

Hmm yeah, I see that behaviour as well - I’ve never seen it happen in mocha tests, so it must be something jest is doing 😃

Adding

afterAll(function () {
 sequelize.close();
});

works fine though

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest - "Cannot log after tests are done." Having problems on ...
I have no idea why the test runner is getting hung up from file imports. Any ideas? node.js · jestjs · sequelize.js ·...
Read more >
Why Jest freezes after tests run? (Jest hangs indefinitely)
If you noticed that Jest (npm / yarn) test hang at the end of the test execution while you run tests in parallel...
Read more >
Jest tests hang due to open Sequelize connections-sequelize.js
This means it is possible to leverage Jest's afterAll to close the sequelize connection pool without having to manually include it in every...
Read more >
Jest Test Of Function That Contain An Async Call To User ...
After all tests pass the execution of jest hangs until it's killed with CTRL+C. The same test with an embedded inmemory sqlite DB...
Read more >
How to use 'sequelize.sync()' without difficulties - Medium
Because the changes in those migration files are already applied to the database when 'sync' is run. 'sync()' command finds any changes in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found