Add test suite

master
Frédéric Matte 2022-12-05 22:21:18 -05:00
parent 6927f40096
commit a46c2d73c8
4 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,8 @@
import assert from 'node:assert/strict'
import { metaltest, consolereporter } from '../index.js'
import { metaltest } from '../index.js'
const test = metaltest('Metaltest')
export { test }
let count = 0
test.before(() => count++)
@ -15,9 +16,7 @@ test('throw', () => {
}, { name: 'Error', message: 'message' })
})
export { test }
import { runifmain } from './runifmain.js'
import { runifmain, consolereporter } from '../index.js'
await runifmain(import.meta, async () => {
const stats = await test.run(consolereporter())
assert.equal(count, 4)

View File

@ -1,8 +1,9 @@
import assert from 'node:assert/strict'
import { metaltest, consolereporter } from '../index.js'
import { metaltest } from '../index.js'
import { stackParser } from './stackparser.js'
const test = metaltest('Stack parser')
export { test }
test('Diff', () => {
try {
@ -16,4 +17,5 @@ test('Diff', () => {
}
})
await test.run(consolereporter())
import { runifmain, consolereporter } from '../index.js'
await runifmain(import.meta, () => test.run(consolereporter()))

View File

@ -5,7 +5,7 @@
"type": "module",
"exports": "./index.js",
"scripts": {
"test": "node test.js"
"test": "node suite.js"
},
"repository": {
"type": "git",

3
suite.js Normal file
View File

@ -0,0 +1,3 @@
import { suite } from './index.js'
await suite()