diff --git a/lib/clock.js b/lib/clock.js index edd4490..c1192d8 100644 --- a/lib/clock.js +++ b/lib/clock.js @@ -1,4 +1,4 @@ -const { debug } = require('node:util'); +const { debug, types } = require('node:util'); const { validateNumber } = require('./validators'); let debugBench = debug('benchmark', (fn) => { @@ -199,7 +199,7 @@ const SyncFunction = function () { }.constructor; function createRunner(bench, recommendedCount) { - const isAsync = bench.fn.constructor === AsyncFunction; + const isAsync = types.isAsyncFunction(bench.fn); const hasArg = bench.fn.length >= 1; if (bench.fn.length > 1) {