test: introduce common.crashOnUnhandledRejection

Ref: https://github.com/nodejs/node/pull/12442
PR-URL: https://github.com/nodejs/node/pull/12489
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>
This commit is contained in:
Anna Henningsen committed 2017-04-27 17:40:03 +02:00
1 parent 2055fd371f
commit dca08152cb
1 file changed
+6
+6
View File
@@ -677,3 +677,9 @@ exports.getArrayBufferViews = function getArrayBufferViews(buf) {
}
return out;
};
// Crash the process on unhandled rejections.
exports.crashOnUnhandledRejection = function() {
process.on('unhandledRejection',
(err) => process.nextTick(() => { throw err; }));
};