Extract stats creation

master
Frédéric Matte 2022-12-06 20:05:29 -05:00
parent 0b7776957d
commit ded9237acc
1 changed files with 6 additions and 4 deletions

View File

@ -11,6 +11,10 @@ const metaltest = (title) => {
const testSuccess = []
const testFail = []
const stats = () => {
return { title, success, fail, total: success + fail, testSuccess, testFail }
}
const runner = (name, fn) => {
suite.push({ name, fn })
}
@ -48,11 +52,9 @@ const metaltest = (title) => {
}
}
const stats = { title, success, fail, total: success + fail, testSuccess, testFail }
for (const test of end) {
try {
await test.fn(stats)
await test.fn(stats())
success++
testSuccess.push(test)
@ -66,7 +68,7 @@ const metaltest = (title) => {
for (const fn of after) await fn()
notify(reporters, 'end', stats)
notify(reporters, 'end', stats())
return stats
}