-
-
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
Access the number of workers in globalSetup #10552
Comments
i worked around this by assuming that |
One thing to keep in mind is that maxWorkers "defaults to the number of the cores available on your machine minus one for the main thread". I was looking for a way to use more workers, but the default setting actually seems like it might be ideal. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This is passed as config to the exported function, isn't it? |
I am using jest version 29.3.1 and I found it process.env.JEST_WORKER_ID |
@alencarandre I think this stands for the unique ID each worker has, rather than the total count. |
Correct, that's something different. #6486 made sure to pass |
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. |
🚀 Feature Proposal
Add an environment variable or otherwise expose to the
globalSetup
script how many jest workers are being spun up for a test runMotivation
I want to setup
n
separate databases to run database tests in parallel while still maintaining isolation from aglobalSetup
script that happens before all test suites, and then access them based on theJEST_WORKER_ID
flag, like described in this article. But unfortunately it doesn't seem like theJEST_WORKERS
env var in that article actually exists; I can't find it in my environment nor in thejest
source by searching for it here on Github source, issues, PRs.Example
See the article linked above
Pitch
Jest internally decides the number of workers so it's not straightforward to do this outside of it if I understand correctly
The text was updated successfully, but these errors were encountered: