diff options
author | Ray Myers <raydog87@gmail.com> | 2016-06-23 11:38:57 -0700 |
---|---|---|
committer | Ray Myers <raydog87@gmail.com> | 2016-06-23 11:38:57 -0700 |
commit | affd5266954def899d074d48dff478550a2d1d6d (patch) | |
tree | 4a22cea4f7be5af7d721ea23334836c1420da20a | |
parent | 3ef90dac66ca93566ad162765fe24a122cb639cf (diff) | |
download | async-affd5266954def899d074d48dff478550a2d1d6d.tar.gz |
Remove unhandled rejection listener after asyncify tests are complete
-rw-r--r-- | mocha_test/asyncify.js | 10 |
1 files 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) { |