diff --git a/test/common.js b/test/common.js index dcd830420c3c6f..54357af6ca8e4c 100644 --- a/test/common.js +++ b/test/common.js @@ -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; })); +};