-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
catch child process killed with a signal #5810
Changes from all commits
825a4d7
9cfee20
bb3d9e7
035b275
93b63af
ab7bca3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
exports['lib/exec/spawn .start detects kill signal exits with error on SIGKILL 1'] = ` | ||
The Test Runner unexpectedly exited via a [36mexit[39m event with signal [36mSIGKILL[39m | ||
|
||
Please search Cypress documentation for possible solutions: | ||
|
||
[34mhttps://on.cypress.io[39m | ||
|
||
Check if there is a GitHub issue describing this crash: | ||
|
||
[34mhttps://github.com/cypress-io/cypress/issues[39m | ||
|
||
Consider opening a new issue. | ||
|
||
---------- | ||
|
||
Platform: darwin (Foo-OsVersion) | ||
Cypress Version: 0.0.0 | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,15 @@ const tty = require('tty') | |
const path = require('path') | ||
const EE = require('events') | ||
const mockedEnv = require('mocked-env') | ||
const debug = require('debug')('test') | ||
|
||
const state = require(`${lib}/tasks/state`) | ||
const xvfb = require(`${lib}/exec/xvfb`) | ||
const spawn = require(`${lib}/exec/spawn`) | ||
const verify = require(`${lib}/tasks/verify`) | ||
const util = require(`${lib}/util.js`) | ||
const expect = require('chai').expect | ||
const snapshot = require('../../support/snapshot') | ||
|
||
const cwd = process.cwd() | ||
|
||
|
@@ -171,6 +173,20 @@ describe('lib/exec/spawn', function () { | |
}) | ||
}) | ||
|
||
context('detects kill signal', function () { | ||
it('exits with error on SIGKILL', function () { | ||
this.spawnedProcess.on.withArgs('exit').yieldsAsync(null, 'SIGKILL') | ||
|
||
return spawn.start('--foo') | ||
.then(() => { | ||
throw new Error('should have hit error handler but did not') | ||
}, (e) => { | ||
debug('error message', e.message) | ||
snapshot(e.message) | ||
}) | ||
}) | ||
}) | ||
|
||
Comment on lines
+176
to
+189
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bahmutov I think it would be worth it to add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be tricky though, maybe not worth the time investment unless we have issues with this PR going forward There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not so sure e2e would be worth it
|
||
it('does not start xvfb when its not needed', function () { | ||
this.spawnedProcess.on.withArgs('close').yieldsAsync(0) | ||
|
||
|
@@ -246,6 +262,7 @@ describe('lib/exec/spawn', function () { | |
.then(() => { | ||
throw new Error('should have hit error handler but did not') | ||
}, (e) => { | ||
debug('error message', e.message) | ||
expect(e.message).to.include(msg) | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
.catch()
pattern is highly preferred over passing two arguments to.then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, in this case,
catch
would let false positive slide (we really want NOT to resolve). Ideally we would plug in https://www.chaijs.com/plugins/chai-as-promised/