diff --git a/lib/metaltest.js b/lib/metaltest.js index 7881c16..4a3104e 100644 --- a/lib/metaltest.js +++ b/lib/metaltest.js @@ -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 }