2026-05-05 14:46:18 +02:00
|
|
|
import { execFileSync } from "node:child_process";
|
|
|
|
|
import { readdirSync } from "node:fs";
|
|
|
|
|
import { join } from "node:path";
|
2026-03-18 00:40:06 -06:00
|
|
|
|
2026-05-02 06:18:25 +02:00
|
|
|
const __dirname = import.meta.dirname;
|
2026-03-18 00:40:06 -06:00
|
|
|
|
|
|
|
|
const testFiles = readdirSync(__dirname)
|
2026-05-05 14:31:16 +02:00
|
|
|
.filter((f) => f.startsWith("test-") && f.endsWith(".ts"))
|
|
|
|
|
.sort();
|
2026-03-18 00:40:06 -06:00
|
|
|
|
|
|
|
|
if (testFiles.length === 0) {
|
2026-05-05 14:31:16 +02:00
|
|
|
console.error("No smoke test files found");
|
|
|
|
|
process.exit(1);
|
2026-03-18 00:40:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let passed = 0;
|
|
|
|
|
let failed = 0;
|
|
|
|
|
|
|
|
|
|
for (const file of testFiles) {
|
2026-05-05 14:31:16 +02:00
|
|
|
const filePath = join(__dirname, file);
|
|
|
|
|
const label = file.replace(/\.ts$/, "");
|
|
|
|
|
try {
|
|
|
|
|
execFileSync("node", ["--experimental-strip-types", filePath], {
|
|
|
|
|
encoding: "utf8",
|
|
|
|
|
stdio: "pipe",
|
|
|
|
|
timeout: 30_000,
|
|
|
|
|
});
|
|
|
|
|
console.log(` PASS ${label}`);
|
|
|
|
|
passed++;
|
|
|
|
|
} catch (err: any) {
|
|
|
|
|
console.error(` FAIL ${label}`);
|
|
|
|
|
if (err.stdout) console.error(err.stdout);
|
|
|
|
|
if (err.stderr) console.error(err.stderr);
|
|
|
|
|
failed++;
|
|
|
|
|
}
|
2026-03-18 00:40:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(`\nSmoke tests: ${passed} passed, ${failed} failed`);
|
|
|
|
|
if (failed > 0) process.exit(1);
|