import { readdirSync } from "node:fs"; import { spawnSync } from "node:child_process"; import path from "node:path"; const testFiles = readdirSync(path.resolve("tests"), { withFileTypes: true, }) .filter((entry) => entry.isFile() && entry.name.endsWith(".test.ts")) .map((entry) => path.join("tests", entry.name)) .sort(); if (testFiles.length === 0) { throw new Error("No TypeScript test files found."); } const watch = process.argv.includes("--watch"); const result = spawnSync( process.execPath, [ "--import", "tsx", "--test", "--test-concurrency=1", ...(watch ? ["--watch"] : []), ...testFiles, ], { stdio: "inherit" } ); process.exit(result.status ?? 1);