diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2016-06-23 14:55:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-23 14:55:14 -0400 |
commit | 14aa7b2ca5388247eec46293d7d792379b045698 (patch) | |
tree | 4a22cea4f7be5af7d721ea23334836c1420da20a | |
parent | e7391046b7a1c74a28d10a08220e39c3af0225a5 (diff) | |
parent | affd5266954def899d074d48dff478550a2d1d6d (diff) | |
download | async-14aa7b2ca5388247eec46293d7d792379b045698.tar.gz |
Merge pull request #1198 from raydog/master
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) { |