diff --git a/test/common/index.js b/test/common/index.js index f0ff81939940e6..db2458a40d26e4 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -493,6 +493,8 @@ exports.mustCallAtLeast = function(fn, minimum) { }; function _mustCallInner(fn, criteria = 1, field) { + if (process._exiting) + throw new Error('Cannot use common.mustCall*() in process exit handler'); if (typeof fn === 'number') { criteria = fn; fn = noop;