Skip to content

Commit

Permalink
test: introduce common.crashOnUnhandledRejection
Browse files Browse the repository at this point in the history
Ref: #12442
PR-URL: #12489
Backport-PR-URL: #13103
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 authored and gibfahn committed Jun 17, 2017
1 parent ae20511 commit 4848862
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 4848862

Please sign in to comment.