Skip to content
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 did not exit one second after the test run has completed. #127

Open
EtienneDx opened this issue Apr 28, 2022 · 1 comment
Open

Jest did not exit one second after the test run has completed. #127

EtienneDx opened this issue Apr 28, 2022 · 1 comment

Comments

@EtienneDx
Copy link

Hi, I've been wrapping my head around this for a few days now, but it seems that jest refuses to exit after the tests are finished. I checked the debug, the teardown is properly executed, but I have the following message popping up every time whatever I try:

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.

I've been running the test on windows 10, both on a directory with real test and on a directory with a single expect(true).toBe(true) and nothing seems to work. Any idea of what I could do?

@jbeale
Copy link

jbeale commented Jun 30, 2023

Make sure you don't have anything in your local environment (some cough certain internal company cough build systems do this) that encapsulates new Node child processes in another environment script before actually launching them. If your build system does that by wrapping node, then Node will receive the PID of the wrapper script instead of the actual DDBLocal Java process. When the dynamodb-local script goes to tear down DDBLocal it'll kill the PID for the script, which will orphan the actual Java process and result in a hang.

I was able to temporarily work around this (until I can submit a pull request for said company build tool) by running this in the afterAll of my tests:

afterAll(() => {
    exec("kill -9 $(pgrep -f DynamoDBLocal)");
});

This being said project maintainers could probably close out this issue. I wasn't able to reproduce it in any other way and even if there's a hack fix it should probably be in the dynamodb-local project, not here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants