-
-
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
Assign process.env.JEST_RUN_IN_BAND
value to check if testing is running serially.
#9280
Conversation
I'm wondering if we should just define |
Thanks, awesome that you found it! I think casting the env variable string=>number=>boolean for a conditional as mentioned there is unlikely to happen and even if, it actually makes sense to me that the worker id is falsy if not running in a worker. So I'm in favor of changing |
I think if use if (process.env.JEST_WORKER_ID == 0)
// do something It is hard to know what it mean in first time. |
All env variables are strings, so I still don't think this is the correct solution to the problem, and making tests behave differently depending on them running in band or not feels like an anti pattern |
Or only set |
@SimenB completely agree... this is most certainly an anti-pattern. However, this is javascript and sometimes other people's anti-patterns force you into writing an anti-pattern yourself just to compensate. It would be nice to have this escape hatch |
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. |
Summary
Issue #9231.
I think use
process.env.JEST_RUN_IN_BAND
can solve this issue, and easier.Test plan
Update
TestScheduler
tests, checkingprocess.env.JEST_RUN_IN_BAND
value.