From affd5266954def899d074d48dff478550a2d1d6d Mon Sep 17 00:00:00 2001 From: Ray Myers Date: Thu, 23 Jun 2016 11:38:57 -0700 Subject: Remove unhandled rejection listener after asyncify tests are complete --- mocha_test/asyncify.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mocha_test/asyncify.js b/mocha_test/asyncify.js index 025083a..880f2f2 100644 --- a/mocha_test/asyncify.js +++ b/mocha_test/asyncify.js @@ -77,8 +77,14 @@ describe('asyncify', function(){ // Both Bluebird and native promises emit these events. We handle it because Bluebird // will report these rejections to stderr if we don't, which is a great feature for // normal cases, but not here, since we expect unhandled rejections: - process.on('unhandledRejection', function () { - // Ignore. + function ignoreRejections() {} + + before(function () { + process.on('unhandledRejection', ignoreRejections); + }); + + after(function () { + process.removeListener('unhandledRejection', ignoreRejections); }); names.forEach(function(name) { -- cgit v1.2.1