feat: add JEST_MAX_WORKERS environment variable support#1
Open
vitorveiga wants to merge 121 commits into
Open
Conversation
Add support for setting maxWorkers via the JEST_MAX_WORKERS environment variable. This provides a convenient way to control worker count in CI environments without modifying configuration files or CLI arguments. Priority order: argv.maxWorkers > defaultOptions.maxWorkers > JEST_MAX_WORKERS > CPU-based defaults. The environment variable supports both numeric values and percentage-based values (e.g., "50%"), consistent with existing maxWorkers behavior.
This reverts commit c3b5db8.
…#16009) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…updates (jestjs#16007) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…date (jestjs#16059) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…jestjs#15977) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…oup across 1 directory (jestjs#16149) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(runtime): avoid magical `null` value * changelog * review comments * another fix * constant * sorted * ah, not here
…er compatibility (jestjs#16167)
…plement `clearMocksOnScope` (jestjs#16169)
Co-authored-by: Tim Seckinger <github@jeys.al>
Also add specific instructions to many packages
… unnecessary checks (jestjs#15721)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maxWorkersvia theJEST_MAX_WORKERSenvironment variable"4") and percentage-based values (e.g.,"50%")Changes
packages/jest-config/src/getMaxWorkers.ts: Added check forprocess.env.JEST_MAX_WORKERSin the resolution priority chainpackages/jest-config/src/__tests__/getMaxWorkers.test.ts: Added 5 new unit tests covering the environment variable functionality, priority order, and percentage supportdocs/Configuration.md: Updated themaxWorkersdocumentation section to explain the priority order and usage ofJEST_MAX_WORKERSPriority Order
The
maxWorkersoption is now resolved in the following order:argv.maxWorkers(CLI argument)defaultOptions.maxWorkers(configuration file)process.env.JEST_MAX_WORKERS(environment variable) ⬅️ newTest Plan
yarn build:jsgetMaxWorkers.test.tspass, including 5 new tests for the environment variable🤖 Generated with Claude Code