Extract stats creation
parent
0b7776957d
commit
ded9237acc
|
@ -11,6 +11,10 @@ const metaltest = (title) => {
|
||||||
const testSuccess = []
|
const testSuccess = []
|
||||||
const testFail = []
|
const testFail = []
|
||||||
|
|
||||||
|
const stats = () => {
|
||||||
|
return { title, success, fail, total: success + fail, testSuccess, testFail }
|
||||||
|
}
|
||||||
|
|
||||||
const runner = (name, fn) => {
|
const runner = (name, fn) => {
|
||||||
suite.push({ 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) {
|
for (const test of end) {
|
||||||
try {
|
try {
|
||||||
await test.fn(stats)
|
await test.fn(stats())
|
||||||
|
|
||||||
success++
|
success++
|
||||||
testSuccess.push(test)
|
testSuccess.push(test)
|
||||||
|
@ -66,7 +68,7 @@ const metaltest = (title) => {
|
||||||
|
|
||||||
for (const fn of after) await fn()
|
for (const fn of after) await fn()
|
||||||
|
|
||||||
notify(reporters, 'end', stats)
|
notify(reporters, 'end', stats())
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue