Use stats to count the number of test
parent
a46c2d73c8
commit
6609486566
|
@ -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')
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue