diff options
| author | EuAndreh <eu@euandre.org> | 2023-11-10 15:41:35 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2023-11-10 15:41:38 -0300 |
| commit | d6d3bd0ac13b9d3137218e6a8f1e242ce8b79b03 (patch) | |
| tree | cbab6c1934c2631ae019eeec8fcd1108ac68efeb /tests | |
| parent | tests/js/utils.js: Remove test on "new Date()" objects (diff) | |
| download | papod-d6d3bd0ac13b9d3137218e6a8f1e242ce8b79b03.tar.gz papod-d6d3bd0ac13b9d3137218e6a8f1e242ce8b79b03.tar.xz | |
tests/js/: Run the files directly
Instead of dynamically `import()`ing them in `tests/runner.js`, make
each test file instead load `tests/runner.js` and run its own tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/js/utils.js | 7 | ||||
| -rw-r--r-- | tests/runner.js | 19 |
2 files changed, 10 insertions, 16 deletions
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, +}; |
