You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When interrupting the Cypress process with SIGINT during the execution of a test the following error is displayed:
We stopped running your tests because a plugin crashed.
Your pluginsFile threw an error from: /home/tom/cypress-test/src/plugin.ts
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at new NodeError (node:internal/errors:370:5)
at ChildProcess.target.send (node:internal/child_process:724:16)
at Object.send (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/plugins/util.js:32:25)
at EventEmitter.<anonymous> (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/plugins/preprocessor.js:45:16)
at EventEmitter.emit (node:events:406:35)
at Object.removeFile (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/plugins/preprocessor.js:119:17)
at Object.options.onBrowserClose (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/open_project.js:135:40)
at EventEmitter.<anonymous> (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/browsers/index.js:212:19)
at Object.onceWrapper (node:events:513:28)
at EventEmitter.emit (node:events:394:28)
at BrowserWindow.<anonymous> (/home/tom/.cache/Cypress/9.5.3/Cypress/resources/app/packages/server/lib/browsers/electron.js:431:25)
at Object.onceWrapper (node:events:514:26)
at BrowserWindow.emit (node:events:406:35)
Based on the text above the stack trace I would assume I made a mistake in my plugin.tspluginsFile, however, that is actually empty. Without a custom pluginFile, the error will default to the 'standard' Cypress plugin file (plugin.js).
Desired behavior
I would expect that Cypress checks whether or not the file:preprocessor child process is still connected or not terminated before trying to send something on its IPC channel. If disconnected or terminated, Cypress should not try to send something to the child process.
In other words, I would expect that I do not get an error.
describe('an elaborate test',()=>{it('can wait',()=>{cy.wait(10000);// wait to allow us to interrupt the Cypress process});});
The SUT is just a simple web server with two pages, / containing a link to /page2.html
Execute npm start or node --loader ts-node/esm index.ts.
Cypress Version
9.5.3
Other
Tested on Ubuntu 20.04 and 21.10, with node versions v16.5.0, v17.4.0, and v17.9.0. Also tested with Cypress 9.5.0.
The following check is performed before trying to send something, however, it purely checks whether or not the process is killed. The process might already have been disconnected at this point (or even terminated).
The code for this is done in cypress-io/cypress#21011, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Current behavior
When interrupting the Cypress process with
SIGINT
during the execution of a test the following error is displayed:Based on the text above the stack trace I would assume I made a mistake in my
plugin.ts
pluginsFile
, however, that is actually empty. Without a custompluginFile
, the error will default to the 'standard' Cypress plugin file (plugin.js
).Desired behavior
I would expect that Cypress checks whether or not the
file:preprocessor
child process is still connected or not terminated before trying to send something on its IPC channel. If disconnected or terminated, Cypress should not try to send something to the child process.In other words, I would expect that I do not get an error.
Test code to reproduce
package.json
:index.ts
:src/overwrite.ts
:// is empty
src/plugin.ts
:cypress/integration/interrupt.spec.ts
:The SUT is just a simple web server with two pages,
/
containing a link to/page2.html
Execute
npm start
ornode --loader ts-node/esm index.ts
.Cypress Version
9.5.3
Other
Tested on Ubuntu 20.04 and 21.10, with node versions v16.5.0, v17.4.0, and v17.9.0. Also tested with Cypress 9.5.0.
The following check is performed before trying to send something, however, it purely checks whether or not the process is killed. The process might already have been disconnected at this point (or even terminated).
cypress/packages/server/lib/plugins/util.js
Lines 28 to 30 in 933e0eb
aProcess
looks like this when it passes theif
above:To at least make sure that the process is not disconnected this additional check should be added:
You could go even further by checking the termination status through
.exitCode
, but I do not think that would be more helpful in this situation.The text was updated successfully, but these errors were encountered: