mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-09 00:30:16 -06:00
fix: Plugin error when sending on disconnected IPC channel (#21011)
* fix: Plugin error when sending on disconnected IPC channel * Add unit test for new no send behaviour Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@ module.exports = {
|
||||
|
||||
return {
|
||||
send (event, ...args) {
|
||||
if (aProcess.killed) {
|
||||
if (aProcess.killed || !aProcess.connected) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ describe('lib/plugins/util', () => {
|
||||
this.theProcess = {
|
||||
send: sinon.spy(),
|
||||
on: sinon.stub(),
|
||||
connected: true,
|
||||
}
|
||||
|
||||
this.ipc = util.wrapIpc(this.theProcess)
|
||||
@@ -31,6 +32,13 @@ describe('lib/plugins/util', () => {
|
||||
expect(this.theProcess.send).not.to.be.called
|
||||
})
|
||||
|
||||
it('#send does not send if process has been disconnected', function () {
|
||||
this.theProcess.connected = false
|
||||
this.ipc.send('event-name')
|
||||
|
||||
expect(this.theProcess.send).not.to.be.called
|
||||
})
|
||||
|
||||
it('#on listens for process messages that match event', function () {
|
||||
const handler = sinon.spy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user