diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | tests/js/utils.js | 7 | ||||
-rw-r--r-- | tests/runner.js | 19 |
3 files changed, 11 insertions, 17 deletions
@@ -81,7 +81,7 @@ src/index.js: .SUFFIXES: .js .js-t tests.js-t = $(tests.js:.js=.js-t) $(tests.js-t): - node tests/runner.js $*.js + node $*.js check-t: $(tests.js-t) diff --git a/tests/js/utils.js b/tests/js/utils.js index 523352a..b86d8c2 100644 --- a/tests/js/utils.js +++ b/tests/js/utils.js @@ -1,4 +1,5 @@ -import { eq, keys } from "../../src/utils.js"; +const { runTests } = require("../runner.js"); +const { eq, keys } = require("../../src/utils.js"); const test_eq = t => { t.start("eq()"); @@ -121,7 +122,9 @@ const test_keys = t => { }); }; -export const tests = [ +const tests = [ test_eq, test_keys, ]; + +runTests(tests); diff --git a/tests/runner.js b/tests/runner.js index 2e4e2ce..ca0c183 100644 --- a/tests/runner.js +++ b/tests/runner.js @@ -1,5 +1,4 @@ -import { getExit, ARGV } from "../src/compat.js"; -import { eq } from "../src/utils.js"; +const { eq } = require("../src/utils.js"); class AssertionError extends Error {} @@ -37,20 +36,12 @@ const t = { }, }; -const main = async () => { - const { tests } = await import(`../${ARGV[1]}`); +const runTests = async tests => { for (const testFn of tests) { await testFn(t); } }; - -getExit().then(async exit => { - try { - await main(); - exit(0); - } catch (e) { - console.error(e); - exit(1); - } -}); +module.exports = { + runTests, +}; |