diff --git a/samples/test/test.js b/samples/test/test.js index 58363cd..6331a6c 100644 --- a/samples/test/test.js +++ b/samples/test/test.js @@ -16,7 +16,7 @@ const {assert} = require('chai'); const {describe, it} = require('mocha'); const cp = require('child_process'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = (cmd) => cp.execSync(cmd, {encoding: 'utf-8'}); describe('quickstart samples', () => { it('should run the quickstart', async () => { @@ -24,4 +24,3 @@ describe('quickstart samples', () => { assert.include(stdout, 'Well hello there, nodestronaut!'); }); }); - diff --git a/test/index.ts b/test/index.ts index cf505e4..267b9f2 100644 --- a/test/index.ts +++ b/test/index.ts @@ -370,13 +370,15 @@ describe('callbackify', () => { const error = new Error('err'); const callback = sinon.stub().throws(error); const originalRejection = process.listeners('unhandledRejection').pop(); - if (originalRejection) + if (originalRejection) { process.removeListener('unhandledRejection', originalRejection!); + } process.once('unhandledRejection', err => { assert.strictEqual(error, err); assert.ok(callback.calledOnce); - if (originalRejection) + if (originalRejection) { process.listeners('unhandledRejection').push(originalRejection!); + } }); func(callback); });