diff --git a/test/common/index.js b/test/common/index.js index 164817fb0a8913..7e94bc766de369 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -506,6 +506,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;