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