From 660948656684838f40b9ec9d1775a583366e331a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Mon, 5 Dec 2022 22:22:58 -0500 Subject: [PATCH] Use stats to count the number of test --- lib/metaltest.test.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/metaltest.test.js b/lib/metaltest.test.js index 5fcfb81..0058e59 100644 --- a/lib/metaltest.test.js +++ b/lib/metaltest.test.js @@ -4,9 +4,6 @@ import { metaltest } from '../index.js' const test = metaltest('Metaltest') export { test } -let count = 0 -test.before(() => count++) - test('success', () => new Promise((s, f) => setTimeout(s, 500))) test('not equal', () => assert.notEqual({ a: 1 }, { a: 2 })) test('fail with the message', () => new Promise((s, f) => setTimeout(s, 500))) @@ -19,7 +16,8 @@ test('throw', () => { import { runifmain, consolereporter } from '../index.js' await runifmain(import.meta, async () => { const stats = await test.run(consolereporter()) - assert.equal(count, 4) assert.equal(stats.success, 4) assert.equal(stats.fail, 0) + assert.equal(stats.total, 4) + assert.equal(stats.title, 'Metaltest') })