Skip to content

Commit

Permalink
test: introduce common.crashOnUnhandledRejection
Browse files Browse the repository at this point in the history
Ref: nodejs#12442
PR-URL: nodejs#12489
Reviewed-By: Matthew Loring <[email protected]>
Reviewed-By: Julien Gilli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax committed May 18, 2017
1 parent b09f738 commit cb5c93a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,9 @@ exports.expectWarning = function(name, expected) {
expected.splice(expected.indexOf(warning.message), 1);
}, expected.length));
};

// Crash the process on unhandled rejections.
exports.crashOnUnhandledRejection = function() {
process.on('unhandledRejection',
(err) => process.nextTick(() => { throw err; }));
};

0 comments on commit cb5c93a

Please sign in to comment.