Add spec for unhandledRejection event in main process

This commit is contained in:
Kevin Sawicki 2017-01-25 09:04:25 -08:00
parent 24fb560a9d
commit 1004d205d8
2 changed files with 31 additions and 8 deletions

View file

@ -131,7 +131,7 @@ describe('node feature', function () {
})
describe('error thrown in renderer process node context', function () {
it('gets emitted as an process uncaughtException event', function (done) {
it('gets emitted as a process uncaughtException event', function (done) {
const error = new Error('boo!')
const listeners = process.listeners('uncaughtException')
process.removeAllListeners('uncaughtException')
@ -156,6 +156,13 @@ describe('node feature', function () {
})
})
describe('promise rejection in main process node context', function () {
it('gets emitted as a process unhandledRejection event', function () {
const error = ipcRenderer.sendSync('handle-unhandled-rejection', 'hello')
assert.equal(error, 'hello')
})
})
describe('setTimeout called under Chromium event loop in browser process', function () {
it('can be scheduled in time', function (done) {
remote.getGlobal('setTimeout')(done, 0)