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 #33

Open
BenjaBobs opened this issue Dec 10, 2021 · 3 comments
Open

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

BenjaBobs opened this issue Dec 10, 2021 · 3 comments

Comments

@BenjaBobs
Copy link

BenjaBobs commented Dec 10, 2021

Hi!

In my current setup I'm using the following versions

"scripts": {
	"test": "vite-jest",
},
"devDependencies": {
	"jest": "^27.4.3",
	"jest-environment-jsdom": "^27.4.3",
	"vite": "^2.7.1",
	"vite-jest": "^0.1.4"
}

My test runs fine and everything passes, but after that, I get the following message:

Ran all test suites.
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.

And the process just hangs.
This is fine for local development (I can just CTRL+C), but it freezes my CI pipeline.

@BenjaBobs
Copy link
Author

I made it work by adding the option --forceExit

-	"test": "vite-jest",
+	"test": "vite-jest --forceExit",

You can close this issue if you want. 🙂

@aapzu
Copy link

aapzu commented Dec 20, 2021

I'm having the same issue. '--forceExit' works, but does not feel like a very good long-term solution

@rszemplinski
Copy link

Agreed, according to the --detectOpenHandles it's saying that it's related to esbuild. Don't know why or how to fix it but thought I'd post it here.

Jest has detected the following 2 open handles potentially keeping Jest from exiting:

  ●  MESSAGEPORT

      at startWorkerThreadService (../../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1978:48)
      at Object.buildSync (../../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1757:29)


  ●  WORKER

      at startWorkerThreadService (../../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1979:16)
      at Object.buildSync (../../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1757:29)

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

No branches or pull requests

3 participants