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 should process.exit(0|1) after tests finish running #3050

Closed
withinboredom opened this issue Mar 3, 2017 · 4 comments
Closed

Jest should process.exit(0|1) after tests finish running #3050

withinboredom opened this issue Mar 3, 2017 · 4 comments

Comments

@withinboredom
Copy link

Do you want to request a feature or report a bug?
feature/bug

What is the current behavior?
If a library misbehaves and doesn't let the process exit, then the process hangs indefinitely, though all tests pass. It could be argued that these libraries may not even be misbehaving as there are some valid reasons to not let the process end naturally.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?
Jest exits the process when all tests are completed and there's nothing more for Jest to test.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
I don't think it is relevant, but here:

@cpojer
Copy link
Member

cpojer commented Mar 3, 2017

That's what --forceExit is for but it's an escape hatch. If Jest doesn't exit, it means you are not cleaning up properly after your tests (use afterAll).

@cpojer cpojer closed this as completed Mar 3, 2017
@adamchenwei
Copy link

The answer did not solve the issue...

@leebenson
Copy link

@cpojer - could you shed some light on why this is considered an escape hatch, and not default behaviour?

My expectation would be that invoking Jest is for the sole purpose of running tests. Once all test blocks have resolved one way or another, and each after* block has been processed, what's the reason to assume that processes that outlive Jest should continue to run?

IMO, these should be killed by default. We have after* for neat clean-up/shutdown if needed, but I'd bet the majority of the time a hard exit wouldn't present any issues.

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants