From 4f096bd8480364757877142c046447e508b84662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Sat, 30 Sep 2023 04:56:59 -0400 Subject: [PATCH] You can pass the tests directly --- lib/runifmain.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/runifmain.js b/lib/runifmain.js index b9ebe1d..2b51303 100644 --- a/lib/runifmain.js +++ b/lib/runifmain.js @@ -10,8 +10,12 @@ import { errorreporter, summaryreporter } from '../index.js' const runifmain = async (meta, fn, ...args) => { if (!isMain(meta)) return - if (args.length == 0) args.push(summaryreporter(), errorreporter()) - await fn(...args) + if (fn.name === 'runner' && fn.run) { + if (args.length == 0) args.push(summaryreporter(), errorreporter()) + await fn.run(...args) + } else { + await fn(...args) + } } export { runifmain }