Skip to content

Commit 4848862

Browse files
addaleaxgibfahn
authored andcommitted
test: introduce common.crashOnUnhandledRejection
Ref: nodejs#12442 PR-URL: nodejs#12489 Backport-PR-URL: nodejs#13103 Reviewed-By: Matthew Loring <mattloring@google.com> Reviewed-By: Julien Gilli <jgilli@nodejs.org> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ae20511 commit 4848862

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/common.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,9 @@ exports.expectWarning = function(name, expected) {
552552
expected.splice(expected.indexOf(warning.message), 1);
553553
}, expected.length));
554554
};
555+
556+
// Crash the process on unhandled rejections.
557+
exports.crashOnUnhandledRejection = function() {
558+
process.on('unhandledRejection',
559+
(err) => process.nextTick(() => { throw err; }));
560+
};

0 commit comments

Comments
 (0)