-
-
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
JEST_WORKER_ID is returning "1" from the 2nd run onwards #6608
Comments
@guyellis I'm not sure that this is a bug in Jest. The following code is used to decide whether Jest should In your example, you have 2 tests, on the second run they are faster than the |
Thanks for pointing me at this @ranyitz I'm wondering if we need to either rename JEST_WORKER_ID or create a new incrementing identifier that increments per test suite? The current behavior might be a bug inasmuch as you'd expect something like JEST_WORKER_ID to increment on a consistent basis from one execution to another. In this example it will increment on the first run before |
Closing as it's working as expected, but please keep the discussion going! |
Thank @thymikee - I've rechecked all my use cases and it turns out that they are covered by this functionality. |
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. |
💥 Regression Report
JEST_WORKER_ID
is returning "1" from the 2nd run onwards.Last working version
Worked up to version: I don't know
Stopped working in version: 23.2.0
To Reproduce
Steps to reproduce the behavior:
Output as Expected on 1st run (equivalent to running after a
--clearCache
)PASS test/one.test.js ● Console console.log test/one.test.js:3 process.env.JEST_WORKER_ID 2 PASS test/two.test.js ● Console console.log test/two.test.js:3 process.env.JEST_WORKER_ID 1 Test Suites: 2 passed, 2 total Tests: 2 passed, 2 total Snapshots: 0 total Time: 1.034s Ran all test suites.
Output On 2nd run -
JEST_WORKER_ID
is always 1PASS test/two.test.js ● Console console.log test/two.test.js:3 process.env.JEST_WORKER_ID 1 PASS test/one.test.js ● Console console.log test/one.test.js:3 process.env.JEST_WORKER_ID 1 Test Suites: 2 passed, 2 total Tests: 2 passed, 2 total Snapshots: 0 total Time: 0.745s, estimated 1s Ran all test suites.
Expected behavior
JEST_WORKER_ID
should increment with each test suite.Link to repl or repo (highly encouraged)
https://github.com/guyellis/jest-worker-id-one
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: