Skip to content

Commit a738f01

Browse files
fix: don't show EPIPE error (#32873)
* fix: don't show EPIPE error * Update CHANGELOG.md * add debug statements * Create ProjectConfigIpc-real-child-process.spec.ts * Update CHANGELOG.md * Linux lint * Linux lint * Update ProjectConfigIpc-real-child-process.spec.ts * Update ProjectConfigIpc.ts * Update ProjectConfigIpc.ts * avoid flake --------- Co-authored-by: Bill Glesias <[email protected]>
1 parent 490c303 commit a738f01

File tree

3 files changed

+98
-2
lines changed

3 files changed

+98
-2
lines changed

cli/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ _Released 12/16/2025 (PENDING)_
77

88
- `Angular` version 21 is now supported within component testing. Addressed in [#33004](https://github.com/cypress-io/cypress/pull/33004).
99

10+
**Bugfixes:**
11+
12+
- Fixed an issue where a EPIPE error shows up after CTRL+C is done in terminal. Fixes [#30659](https://github.com/cypress-io/cypress/issues/30659). Addressed in [#32873](https://github.com/cypress-io/cypress/pull/32873).
13+
1014
## 15.7.1
1115

1216
_Released 12/2/2025_

packages/data-context/src/data/ProjectConfigIpc.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,16 @@ export class ProjectConfigIpc extends EventEmitter {
157157

158158
let resolved = false
159159

160-
this._childProcess.on('error', (err) => {
160+
this._childProcess.on('error', (err: NodeJS.ErrnoException) => {
161+
if (err.code === 'EPIPE') {
162+
debug('EPIPE error in loadConfig() of child process %s', err)
163+
164+
// @ts-ignore
165+
resolve()
166+
167+
return
168+
}
169+
161170
debug('unhandled error in child process %s', err)
162171
this.handleChildProcessError(err, this, resolved, reject)
163172
reject(err)
@@ -229,7 +238,16 @@ export class ProjectConfigIpc extends EventEmitter {
229238
return new Promise((resolve, reject) => {
230239
let resolved = false
231240

232-
this._childProcess.on('error', (err) => {
241+
this._childProcess.on('error', (err: NodeJS.ErrnoException) => {
242+
if (err.code === 'EPIPE') {
243+
debug('EPIPE error in registerSetupIpcHandlers() of child process %s', err)
244+
245+
// @ts-ignore
246+
resolve()
247+
248+
return
249+
}
250+
233251
this.handleChildProcessError(err, this, resolved, reject)
234252
reject(err)
235253
})
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { describe, expect, it, beforeEach, afterEach, jest } from '@jest/globals'
2+
import { scaffoldMigrationProject as scaffoldProject } from '../helper'
3+
import { ProjectConfigIpc } from '../../../src/data/ProjectConfigIpc'
4+
5+
jest.mock('debug', () => {
6+
globalThis.debugMessages = []
7+
const originalDebugModule = jest.requireActual('debug')
8+
9+
const debug = (namespace) => {
10+
// @ts-expect-error - mock
11+
const originalDebug = originalDebugModule(namespace)
12+
13+
return ((message) => {
14+
if (namespace === 'cypress:lifecycle:ProjectConfigIpc') {
15+
globalThis.debugMessages.push(message)
16+
}
17+
18+
originalDebug(message)
19+
})
20+
}
21+
22+
debug.formatters = {}
23+
24+
return debug
25+
})
26+
27+
describe('ProjectConfigIpc', () => {
28+
describe('real-child-process', () => {
29+
let projectConfigIpc
30+
31+
beforeEach(async () => {
32+
const projectPath = await scaffoldProject('e2e')
33+
34+
projectConfigIpc = new ProjectConfigIpc(
35+
undefined,
36+
undefined,
37+
projectPath,
38+
'',
39+
false,
40+
(error) => {},
41+
() => {},
42+
() => {},
43+
)
44+
})
45+
46+
afterEach(() => {
47+
projectConfigIpc.cleanupIpc()
48+
})
49+
50+
it('EPIPE error test', async () => {
51+
const err: NodeJS.ErrnoException = new Error
52+
53+
err.code = 'EPIPE'
54+
55+
const OG_once = projectConfigIpc.once
56+
57+
projectConfigIpc.once = function (evt, listener) {
58+
if (evt === 'setupTestingType:reply') {
59+
return listener()
60+
}
61+
62+
return OG_once.apply(this, [evt, listener])
63+
}
64+
65+
await projectConfigIpc.loadConfig()
66+
await projectConfigIpc.registerSetupIpcHandlers()
67+
68+
projectConfigIpc._childProcess.emit('error', err)
69+
70+
expect(globalThis.debugMessages.at(-2)).toEqual('EPIPE error in loadConfig() of child process %s')
71+
expect(globalThis.debugMessages.at(-1)).toEqual('EPIPE error in registerSetupIpcHandlers() of child process %s')
72+
}, 20_000)
73+
})
74+
})

0 commit comments

Comments
 (0)