From a46c2d73c8be66ca321407850066d2369eb2809c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Mon, 5 Dec 2022 22:21:18 -0500 Subject: [PATCH] Add test suite --- lib/metaltest.test.js | 7 +++---- lib/stackparser.test.js | 6 ++++-- package.json | 2 +- suite.js | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 suite.js diff --git a/lib/metaltest.test.js b/lib/metaltest.test.js index 527a778..5fcfb81 100644 --- a/lib/metaltest.test.js +++ b/lib/metaltest.test.js @@ -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) diff --git a/lib/stackparser.test.js b/lib/stackparser.test.js index 45c3795..e1eb735 100644 --- a/lib/stackparser.test.js +++ b/lib/stackparser.test.js @@ -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())) diff --git a/package.json b/package.json index b7d74e0..b6fa87d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "exports": "./index.js", "scripts": { - "test": "node test.js" + "test": "node suite.js" }, "repository": { "type": "git", diff --git a/suite.js b/suite.js new file mode 100644 index 0000000..357d470 --- /dev/null +++ b/suite.js @@ -0,0 +1,3 @@ +import { suite } from './index.js' + +await suite() \ No newline at end of file