diff --git a/test/common/index.js b/test/common/index.js index ae18ee6a75f10c..9d8ab9e188aa1e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -371,10 +371,28 @@ function _mustCallInner(fn, criteria = 1, field) { mustCallChecks.push(context); - return function() { + const _return = function() { // eslint-disable-line func-style context.actual++; return fn.apply(this, arguments); }; + // Function instances have own properties that may be relevant. + // Let's replicate those properties to the returned function. + // Refs: https://tc39.es/ecma262/#sec-function-instances + Object.defineProperties(_return, { + name: { + value: fn.name, + writable: false, + enumerable: false, + configurable: true, + }, + length: { + value: fn.length, + writable: false, + enumerable: false, + configurable: true, + }, + }); + return _return; } function hasMultiLocalhost() {