[Bug]: Jest v29 error with Babel, Yarn v3: Jest worker encountered 4 child process exceptions, exceeding retry limit

See original GitHub issue

Version

29.1.1

Steps to reproduce

  1. Clone my repo at https://github.com/jgerigmeyer/jest-test
  2. Use Node v16.17.1
  3. yarn install
  4. yarn test

See the error:

Error: Jest worker encountered 4 child process exceptions, exceeding retry limit
    at ChildProcessWorker.initialize (/.../jest-test/.yarn/cache/jest-worker-npm-29.1.0-68250d556a-8ff2ce6026.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:211:21)
    at ChildProcessWorker._onExit (/.../jest-test/.yarn/cache/jest-worker-npm-29.1.0-68250d556a-8ff2ce6026.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:396:12)
    at ChildProcess.emit (node:events:513:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
  1. yarn test -i

No error:

 PASS  ./index.spec.js
  add
    ✓ adds inputs (1 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.328 s, estimated 1 s
Ran all test suites.

Expected behavior

I expect the test to pass.

Actual behavior

Error: Jest worker encountered 4 child process exceptions, exceeding retry limit
    at ChildProcessWorker.initialize (/.../jest-test/.yarn/cache/jest-worker-npm-29.1.0-68250d556a-8ff2ce6026.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:211:21)
    at ChildProcessWorker._onExit (/.../jest-test/.yarn/cache/jest-worker-npm-29.1.0-68250d556a-8ff2ce6026.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:396:12)
    at ChildProcess.emit (node:events:513:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

Additional context

The error is inconsistent, and does not occur on every run. Possibly something to do with memory availability? On a large project with lots of tests, the error seems to occur consistently. On a small sample repo I get it most often right after a fresh yarn install. 🤷

Environment

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
    Yarn: 3.2.3 - ~/.yarn/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, Oct 29, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

1reaction
jgerigmeyercommented, Sep 29, 2022

@ericvera Thanks! I still get the error (with no helpful info) with --maxWorkers=2, but your packageExtensions solution also fixed it for me. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest worker encountered 4 child process exceptions ...
This error seems to be a mix of a few problems, but uncaught ... Jest worker encountered 4 child process exceptions, exceeding retry...
Read more >
Jest worker encountered 4 child process exceptions ...
Coding example for the question Jest worker encountered 4 child process exceptions, exceeding retry limit-Vue.js.
Read more >
jest-worker | Yarn - Package Manager
Module for executing heavy tasks under forked processes in parallel, by providing a Promise based interface, minimum overhead, and bound workers. The module ......
Read more >
Gatsby Changelog | 5.3.0
ERROR #85928 An error occurred during parallel query running. Error: Worker exited before finishing task. Gatsby uses child processes to execute its GraphQL ......
Read more >
Jest worker encountered 4 child process ... - DevPress
Answer a question I am new to vue and jest testing, and I keep getting this error when running a specific test.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found