summaryrefslogtreecommitdiff
path: root/tests/runner.mjs
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-02-23 06:05:19 -0300
committerEuAndreh <eu@euandre.org>2024-02-23 06:05:21 -0300
commitc36bf8e3577da31cf6d575879c7e92d3e9c7e4f1 (patch)
tree4fd5414e76490e297c4c770ff35e09149ef3658f /tests/runner.mjs
parentRemove C code and cleanup repository (diff)
downloadpapod-c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1.tar.gz
papod-c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1.tar.xz
Big cleanup
- delete all SQLite Node-API code: we'll use the C++ one instead; - implement hero.mjs, with tests! - use ESM all over.
Diffstat (limited to 'tests/runner.mjs')
-rw-r--r--tests/runner.mjs32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/runner.mjs b/tests/runner.mjs
new file mode 100644
index 0000000..79bda8c
--- /dev/null
+++ b/tests/runner.mjs
@@ -0,0 +1,32 @@
+import { eq } from "../src/utils.mjs";
+
+class AssertionError extends Error {}
+
+const red = s => `\x1b[31m${s}\x1b[0m`;
+const green = s => `\x1b[32m${s}\x1b[0m`;
+const yellow = s => `\x1b[33m${s}\x1b[0m`;
+
+const t = {
+ tap: x => {
+ console.error("tap:", x);
+ return x;
+ },
+ start: msg => {
+ console.error(`${msg}:`);
+ },
+ test: (msg, fn) => {
+ try {
+ fn();
+ console.error(`${yellow("testing")}: ${msg}... ${green("OK")}`);
+ } catch (e) {
+ console.error(`${yellow("testing")}: ${msg}... ${red("FAIL")}`);
+ throw e;
+ }
+ },
+};
+
+export const runTests = async tests => {
+ for (const testFn of tests) {
+ await testFn(t);
+ }
+};