Skip to content

fix(jest-config): correct maxWorkers description - #16466

Open
januththedev wants to merge 2 commits into
jestjs:mainfrom
januththedev:fix-maxworkers-description
Open

januththedev wants to merge 2 commits into
jestjs:mainfrom
januththedev:fix-maxworkers-description

Conversation

@januththedev

Copy link
Copy Markdown

Fixes #16465. The scaffolded maxWorkers description now matches the implemented floor-and-clamp percentage formula, with a regression assertion and changelog entry. Local dependency installation was not completed, so the focused test will run in CI.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: januththedev / name: Januth Nimnal (2a4895a)

@netlify

netlify Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5392a6e
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/6ac0e00f3d3ab20008d463c1
😎 Deploy Preview https://deploy-preview-16466--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the require-changelog If a PR does requires a changelog entry label Sep 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@16466

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@16466

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@16466

create-jest

npm i https://pkg.pr.new/create-jest@16466

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@16466

expect

npm i https://pkg.pr.new/expect@16466

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@16466

jest

npm i https://pkg.pr.new/jest@16466

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@16466

jest-circus

npm i https://pkg.pr.new/jest-circus@16466

jest-cli

npm i https://pkg.pr.new/jest-cli@16466

jest-config

npm i https://pkg.pr.new/jest-config@16466

@jest/console

npm i https://pkg.pr.new/@jest/console@16466

@jest/core

npm i https://pkg.pr.new/@jest/core@16466

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@16466

jest-diff

npm i https://pkg.pr.new/jest-diff@16466

jest-docblock

npm i https://pkg.pr.new/jest-docblock@16466

jest-each

npm i https://pkg.pr.new/jest-each@16466

@jest/environment

npm i https://pkg.pr.new/@jest/environment@16466

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@16466

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@16466

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@16466

@jest/expect

npm i https://pkg.pr.new/@jest/expect@16466

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@16466

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@16466

@jest/globals

npm i https://pkg.pr.new/@jest/globals@16466

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@16466

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@16466

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@16466

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@16466

jest-message-util

npm i https://pkg.pr.new/jest-message-util@16466

jest-mock

npm i https://pkg.pr.new/jest-mock@16466

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@16466

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@16466

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@16466

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@16466

jest-resolve

npm i https://pkg.pr.new/jest-resolve@16466

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@16466

jest-runner

npm i https://pkg.pr.new/jest-runner@16466

jest-runtime

npm i https://pkg.pr.new/jest-runtime@16466

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@16466

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@16466

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@16466

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@16466

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@16466

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@16466

@jest/transform

npm i https://pkg.pr.new/@jest/transform@16466

@jest/types

npm i https://pkg.pr.new/@jest/types@16466

jest-util

npm i https://pkg.pr.new/jest-util@16466

jest-validate

npm i https://pkg.pr.new/jest-validate@16466

jest-watcher

npm i https://pkg.pr.new/jest-watcher@16466

jest-worker

npm i https://pkg.pr.new/jest-worker@16466

pretty-format

npm i https://pkg.pr.new/pretty-format@16466

commit: 5392a6e

@januththedev
januththedev force-pushed the fix-maxworkers-description branch from 9916d27 to 19498ac Compare September 26, 2026 12:55
@januththedev
januththedev force-pushed the fix-maxworkers-description branch from 19498ac to 218338e Compare September 26, 2026 13:35
@januththedev

Copy link
Copy Markdown
Author

The first CI run failed three create-jest snapshot tests, and that one was on me:

● init › ... › should return the default configuration (an empty config)
● init › ... › should generate empty config with mjs extension
● init › project using jest.config.ts › ask the user whether he wants to use Typescript or not

create-jest init embeds the Descriptions text as comments in the config it writes, so changing a description changes the generated file. The committed snapshot in packages/create-jest/src/__tests__/__snapshots__/init.test.ts.snap still carried the old maxWorkers wording, so the three snapshots that include it no longer matched:

- // ... E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. ...
+ // ... E.g. maxWorkers: 10% will use 10% of the available CPUs, rounded down with a minimum of 1. ...

I updated those three snapshot entries to match. A repo-wide grep confirmed init.test.ts.snap is the only file carrying that string, so there is no other stale copy.

Note for review: the old wording was not merely imprecise. getMaxWorkers computes Math.max(Math.floor(numCpus * percentage / 100), 1), so 10% floors the CPU count and then clamps to a minimum of 1 — it never adds 1.

I could not execute the Jest suite locally to confirm the snapshot regeneration, since this checkout has no node_modules and a full monorepo install was not practical here. Instead I verified programmatically that all three snapshot lines are byte-identical to the maxWorkers string in Descriptions.ts, which is exactly the transformation the failing assertion reported.

@januththedev

Copy link
Copy Markdown
Author

CI is green on 218338e. All test jobs pass on Ubuntu, Windows, and macOS across Node 18 through 26 plus the jasmine2 runs, along with the leak-detection, coverage, and TypeScript compatibility jobs. The three create-jest snapshot tests that failed before now pass with the updated snapshot.

The only check still red is EasyCLA, which needs the CLA signature from a human account rather than anything in the diff.

@januththedev
januththedev force-pushed the fix-maxworkers-description branch from 218338e to 2a4895a Compare October 3, 2026 10:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

require-changelog If a PR does requires a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

maxWorkers description uses the wrong percentage formula

1 participant