Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Jest worker encountered 3 child process exceptions, exceeding retry limit #13007

Closed
shaobeichen opened this issue Jul 11, 2022 · 12 comments
Labels
Bug Report Needs Reproduction Every bug report requires a minimal reproduction Needs Triage

Comments

@shaobeichen
Copy link

shaobeichen commented Jul 11, 2022

Version

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
@troncoso
Copy link

I am having the exact same issue (obviously with a different file though). The differences in my environment are:

OS - MacOS Monteray v12.4
Node - v18.2.0
NPM - v8.9.0
jest - 28.1.3

@wkul9429
Copy link

wkul9429 commented Aug 9, 2022

Hi I'm also facing the same issue, what is the reason for this
Node v16.15.1
NPM 8.11.0
jest 28.1.3

@mrsolarius
Copy link

mrsolarius commented Aug 9, 2022

I can also reproduce it with this environment:
Windows 10
Intel(R) Core(TM) i7-8650U CPU @ 1.90GHZ
Node v16.15.0
NPM : 8.5.5
jest 28.1.3

@KyDenZ
Copy link

KyDenZ commented Aug 24, 2022

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

@shaobeichen
Copy link
Author

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

oh thanks, i'll try it tonight

@wkul9429
Copy link

My issue was with mocks, after fixing them issue got resolved

@SimenB SimenB added the Needs Reproduction Every bug report requires a minimal reproduction label Aug 25, 2022
@github-actions
Copy link

As noted in the Bug Report template, all bug reports requires a minimal reproduction. Please open up a new issue providing one. Read more at https://stackoverflow.com/help/minimal-reproducible-example.

@havenchyk
Copy link

My issue was with mocks, after fixing them issue got resolved

@wkul9429 how exactly did you fix it?

@dr-azbest
Copy link

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.

@ddbhagat
Copy link

It appears that Node 15 introduced a breaking change to promise rejection handling. Reference https://developer.ibm.com/blogs/nodejs-15-release-blog/

@havenchyk
Copy link

yes, it's the problem. And it turned out debugging of unhandled rejected promises is so painful

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Report Needs Reproduction Every bug report requires a minimal reproduction Needs Triage
Projects
None yet
Development

No branches or pull requests

9 participants