// The black-box suite: compile :testlib to node-consumable ESM (with the same
// closure-defines the app build injects — the catalog snapshot is one of them,
// and loadCatalog's fallback path is under test), then run node --test.
import { spawnSync } from "node:child_process";
import { join } from "node:path";
import { CLIENT as client, appDefines } from "./defines.mjs";
const shadow = join(client, "node_modules", ".bin", "shadow-cljs");
const run = (cmd, args) => {
const r = spawnSync(cmd, args, { cwd: client, stdio: "inherit" });
if (r.status !== 0) process.exit(r.status ?? 1);
};
run(shadow, ["release", "testlib", ...appDefines()]);
// No resolve hook any more. The suite kits are ClojureScript SOURCE on this
// build's classpath, so `ardegazu-social-kit` is not a module the testlib
// imports and there is nothing left to intercept: the one network seam the
// leaderboard vectors cannot reach (fetch-weekly) is swapped through the
// testlib's own setFetchWeekly export instead. See home.testlib.
run(process.execPath, ["--test", "test/*.test.mjs"]);