From 73b1b24e71726bdd00633b217395ab118b55af04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Sat, 30 Sep 2023 04:54:07 -0400 Subject: [PATCH] Make summary and error the default reporters --- lib/runifmain.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/runifmain.js b/lib/runifmain.js index d4693ef..b9ebe1d 100644 --- a/lib/runifmain.js +++ b/lib/runifmain.js @@ -6,10 +6,12 @@ const isMain = (meta) => { return path.includes(process.argv[1]) } -const runifmain = async (meta, fn) => { - if (isMain(meta)) { - await fn() - } +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) } -export { runifmain } \ No newline at end of file +export { runifmain }