Skip to content

Limit root Jest parallelism to reduce memory pressure#1458

Open
kelvinkipruto wants to merge 2 commits intomainfrom
codex/review-memory-leaks-in-jest
Open

Limit root Jest parallelism to reduce memory pressure#1458
kelvinkipruto wants to merge 2 commits intomainfrom
codex/review-memory-leaks-in-jest

Conversation

@kelvinkipruto
Copy link
Copy Markdown
Contributor

Motivation

  • Running Jest from the repo root (for example pnpm jest -- -u .) fans out many package-level test tasks and each task can spawn multiple Jest workers, producing multiplicative parallelism and very high memory usage; the root script should cap concurrency to avoid this.

Description

  • Update the root jest script in package.json to run turbo run jest --concurrency=2 -- --maxWorkers=50%, keeping jest:ci and jest:debug behaviors unchanged.

Testing

  • Ran pnpm jest -- --help to verify argument wiring through Turbo/Jest; the invocation reached package tasks but the execution failed in this environment due to Corepack network fetch errors (ENETUNREACH), not due to the script change, so argument forwarding was observed but full test execution could not complete.

Codex Task

@kilemensi
Copy link
Copy Markdown
Member

We have jest:ci @kelvinkipruto that already limits concurrency and maxWorkers for cases where machine is limited e.g. when running in GitHub Actions.

@kelvinkipruto
Copy link
Copy Markdown
Contributor Author

We have jest:ci @kelvinkipruto that already limits concurrency and maxWorkers for cases where machine is limited e.g. when running in GitHub Actions.

@kilemensi I tried running jest across all the apps in my machine, and it consumed 40GB of RAM, freezing it.
Told codex to try and fix it, and this is the response.
I haven't tested this out yet, but will try and see if there is any improvements.

@kilemensi
Copy link
Copy Markdown
Member

kilemensi commented Apr 16, 2026

@kilemensi I tried running jest across all the apps in my machine, and it consumed 40GB of RAM, freezing it. Told codex to try and fix it, and this is the response. I haven't tested this out yet, but will try and see if there is any improvements.

I'm aware of that problem and that's why I created a very detailed fix @kelvinkipruto . I'm going through the @/trustlab source code now and it's very evident you and @koechkevin do not review or know half of the code already in the repo despite working on it for years at this problem. It's a problem that needs to be address promptly.

@kilemensi
Copy link
Copy Markdown
Member

I assume you've had time to test jest:ci @kelvinkipruto, no?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants