From da4e60b078e47207ce66998700c988339496e8b5 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 1 Apr 2020 05:20:56 -0700 Subject: [PATCH] build(tests): fix coveralls and enable build cop (#175) https://github.com/googleapis/nodejs-promisify/commit/7b703ce18ac98deda95edb6bf3b73e93e6d86b27 commit 7b703ce18ac98deda95edb6bf3b73e93e6d86b27 Author: Benjamin E. Coe Date: Mon Mar 23 10:55:24 2020 -0700 build(tests): fix coveralls and enable build cop (#175) --- .mocharc.json | 6 ------ samples/test/test.js | 3 +-- synth.metadata | 2 +- test/index.ts | 8 ++++++-- 4 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 .mocharc.json diff --git a/.mocharc.json b/.mocharc.json deleted file mode 100644 index c87672c..0000000 --- a/.mocharc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "require": "hard-rejection/register", - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} 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/synth.metadata b/synth.metadata index 2f5e98d..fbbcf4b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-04-01T12:20:50.434391Z", + "updateTime": "2020-04-01T12:20:55.968161Z", "sources": [ { "git": { diff --git a/test/index.ts b/test/index.ts index e04d600..267b9f2 100644 --- a/test/index.ts +++ b/test/index.ts @@ -370,11 +370,15 @@ describe('callbackify', () => { const error = new Error('err'); const callback = sinon.stub().throws(error); const originalRejection = process.listeners('unhandledRejection').pop(); - process.removeListener('unhandledRejection', originalRejection!); + if (originalRejection) { + process.removeListener('unhandledRejection', originalRejection!); + } process.once('unhandledRejection', err => { assert.strictEqual(error, err); assert.ok(callback.calledOnce); - process.listeners('unhandledRejection').push(originalRejection!); + if (originalRejection) { + process.listeners('unhandledRejection').push(originalRejection!); + } }); func(callback); });