Skip to content

Commit 4eb28c8

Browse files
addaleaxMylesBorins
authored andcommitted
test: introduce common.crashOnUnhandledRejection
Ref: #12442 PR-URL: #12489 Backport-PR-URL: #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 f6e58c3 commit 4eb28c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/common.js

+6
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)