-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Mock "exit" in "process" #6815
Mock "exit" in "process" #6815
Conversation
Since functions exposed in `process` are the real ones, `exit` is being exposed as-is. The issue is that calling `process.exit` with a zero exit code might trick the workers, thinking the execution was stopped. Pretty much like we do with `send`, we will override it with an empty method that does nothin.
Missing changelog :o |
Should probably update the text in #6714 as well to say "blocked" or "stubbed" or something |
@SimenB I wasn't aware of this, that's pretty cool! What do you think about moving the code snippet in #6714 into the |
I left out the first part since we need access to |
I've been thinking that once you reach |
(Or, even better, we should probably |
Makes sense. |
@thymikee which one of the two? 😄 |
Hah, I was replying to the first one. I'm just not sure about silently passing |
Yes, but code is being executed in the Jest sandbox. My gut feeling is that you expect your test to be finished, but not killing the entire worker. |
Yup, but throwing wouldn't kill the worker, just fail the whole test suite, or am I missing something? |
The way I see it is that we'd catch this "special error" thrown (e.g. a |
And then re-throw if it was not-0? Or display a warning that |
I don't see any use case for |
The issue I see if we follow that approach is that mocking |
I think #6714 covers this. Reopen if you disagree 🙂 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Since functions exposed in
process
are the real ones,exit
is being exposed as-is. The issue is that callingprocess.exit
with a zero exit code might trick the workers, thinking the execution was stopped.Pretty much like we do with
send
, we will override it with an empty method that does nothin.