[Bug]: Jest worker encountered 3 child process exceptions, exceeding retry limit
See original GitHub issueVersion
28.1.2
Steps to reproduce
https://github.com/shaobeichen/blog
yarn
yarn test:coverage
Expected behavior
no error
Actual behavior
$ yarn test:coverage
yarn run v1.22.19
$ jest --coverage --maxWorkers 2 --unhandled-rejections=warn
PASS src/components/abstract/toast/tests/toast.test.ts
√ 创建一个弹窗,持续3秒 (13 ms)
√ 命令式调用,创建一个弹窗 (12 ms)
Running coverage on untested files…Failed to collect coverage from D:\work\blog\src\utils\request\base.ts
ERROR: Jest worker encountered 3 child process exceptions, exceeding retry limit
STACK: Error: Jest worker encountered 3 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (D:\work\blog\node_modules\jest-worker\build\workers\ChildProcessWorker.js:170:21)
at ChildProcessWorker._onExit (D:\work\blog\node_modules\jest-worker\build\workers\ChildProcessWorker.js:254:12)
at ChildProcess.emit (node:events:520:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
Failed to collect coverage from D:\work\blog\src\utils\request\mofish.ts
ERROR: Jest worker encountered 3 child process exceptions, exceeding retry limit
STACK: Error: Jest worker encountered 3 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (D:\work\blog\node_modules\jest-worker\build\workers\ChildProcessWorker.js:170:21)
at ChildProcessWorker._onExit (D:\work\blog\node_modules\jest-worker\build\workers\ChildProcessWorker.js:254:12)
at ChildProcess.emit (node:events:520:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
-------------------------------|---------|----------|---------|---------|-------------------
| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
|---|---|---|---|---|---|
| All files | 20.86 | 30 | 15.38 | 20.83 | |
| src | 0 | 100 | 100 | 0 | |
| main.ts | 0 | 100 | 100 | 0 | 1-13 |
| src/api | 0 | 100 | 0 | 0 | |
| toast.d.ts | 0 | 0 | 0 | 0 | |
| src/utils | 100 | 100 | 100 | 100 | |
| sleep.ts | 100 | 100 | 100 | 100 | |
| src/utils/request | 0 | 100 | 100 | 0 | |
| index.ts | 0 | 100 | 100 | 0 | 1-6 |
| ------------------------------- | --------- | ---------- | --------- | --------- | ------------------- |
| Test Suites: 1 passed, 1 total | |||||
| Tests: 2 passed, 2 total | |||||
| Snapshots: 0 total | |||||
| Time: 8.779 s | |||||
| Ran all test suites. | |||||
| Done in 9.76s. |
Additional context
“test:coverage”: “jest --coverage --maxWorkers 2”
not work
Environment
System:
OS: Windows 10 10.0.22000
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-11320H @ 3.20GHz
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: ^28.1.2 => 28.1.2
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12
Top Related StackOverflow Question
With Jest 27 I didn’t have the problem, when I switched to Jest 28 I had the same error.
I had problems importing in the files where I had this error.
I don’t know why it was not a problem with the build and with version 27.
Now it works
I had exact same error message on CI tests. It affected all my test cases. This message hides real problem. You have to change maxWorkers to 1 to see what is the problem on single thread. Then you will see cause of error which helps you to resolve issue.