diff --git a/test/common/index.js b/test/common/index.js index a78f90087793c1..0c1e864ad8387c 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;