events.js:288 Error: write EPIPE when executing tests with Jest
Asked Answered
T

4

7

I have a problem when setting React Testing Library into a new project, which is a project that generates common UI components for several projects. In one of the projects it is correctly setup, but when I added React Testing Library and updated dependencies in this project, I am able to run a test but not all of them.

If I do yarn test this is the result:

Test Suites: 8 passed, 8 of 33 total
Tests:       84 passed, 84 total
Snapshots:   0 total
Time:        28 sevents.js:288
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at ChildProcess.target._send (internal/child_process.js:806:20)
    at ChildProcess.target.send (internal/child_process.js:677:19)
    at ChildProcessWorker.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\workers\ChildProcessWorker.js:291:17)
    at WorkerPool.send (C:\Users\user\workspace\project\node_modules\jest-worker\build\WorkerPool.js:32:34)
    at Farm._process (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:129:10)
    at Farm._enqueue (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:152:10)
    at Farm._push (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:159:12)
    at C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:90:14
    at new Promise (<anonymous>)
    at Farm.doWork (C:\Users\user\workspace\project\node_modules\jest-worker\build\Farm.js:56:12)
Emitted 'error' event on ChildProcess instance at:
    at internal/child_process.js:810:39
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  errno: 'EPIPE',
  code: 'EPIPE',
  syscall: 'write'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried doing rm -rf node_modules and then cleaning cache, and didn't work.

Any help?

Tattler answered 27/5, 2020 at 17:12 Comment(0)
T
3

It turns out that by changing some libraries in package.json the error dissapears:

Before (KO):

"babel-jest": "^24.9.0",
"jest": "^26.0.1",

After (OK):

"babel-jest": "^26.0.1",
"jest": "^25.5.4",
Tattler answered 27/5, 2020 at 17:12 Comment(4)
I met the similar errors like you. and change my package.json like you. But I still got the errors. em......Mucus
have you tried going back to previous versions of Jest?Tattler
do you mean older version of jest such as 24.x.x?Mucus
Yes. For me it was a matter of installing the correct version. I know it doesn’t sound very logical, but keep trying until you don’t get the error. That’s all I could do without being able to reproduce the issue in a codesandbox and finding a combination that worked motivated me to post my answer. If you could reproduce your error in a codesandbox we could keep investigating the issue.Tattler
T
3

By doing yarn cache clean solved my problem. If you met pipe error similar like image below. I believe it is related to memory leaks.

enter image description here

Tipcat answered 10/6, 2021 at 0:21 Comment(0)
C
0

In my case was the version of node. I had the version 15 (from Latest Features) and changed it to the stable version 14.17.3 (from LTS).

To know which version you have use node -v in a terminal.

Chitarrone answered 23/7, 2021 at 19:17 Comment(0)
R
0

I was facing same issue with react 18, Nodejs 18 and react script 4.x

I just upgraded react script from 4.x to 5.x

it works

Regnant answered 10/5, 2023 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.