Make summary and error the default reporters

master
Frédéric Matte 2023-09-30 04:54:07 -04:00
parent eade7e15b3
commit 73b1b24e71
1 changed files with 7 additions and 5 deletions

View File

@ -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 }