28 lines
660 B
JavaScript
28 lines
660 B
JavaScript
import fs from "fs";
|
|
|
|
const hasVitestConfig = fs.existsSync("vitest.config.mjs");
|
|
const hasTestsFolder = fs.existsSync("tests");
|
|
const anyTestFiles =
|
|
hasTestsFolder && fs.readdirSync("tests").some((f) => /\.(test|spec)\./.test(f));
|
|
|
|
let ok = true;
|
|
if (!hasVitestConfig) {
|
|
console.error("[tests-audit] MISSING: vitest.config.mjs");
|
|
ok = false;
|
|
}
|
|
if (!hasTestsFolder) {
|
|
console.error("[tests-audit] MISSING: tests/ folder");
|
|
ok = false;
|
|
}
|
|
if (!anyTestFiles) {
|
|
console.error("[tests-audit] MISSING: at least one test file under tests/");
|
|
ok = false;
|
|
}
|
|
|
|
if (ok) {
|
|
console.log("[tests-audit] PASS");
|
|
process.exit(0);
|
|
} else {
|
|
process.exit(1);
|
|
}
|