2026-04-27 12:19:53 +00:00
|
|
|
import { execFileSync } from 'child_process';
|
2026-04-27 11:53:35 +00:00
|
|
|
import { readdirSync } from 'fs';
|
2026-04-27 08:04:03 +00:00
|
|
|
import { join } from 'path';
|
|
|
|
|
|
|
|
|
|
const testsDir = join(import.meta.dirname, '..', 'tests');
|
|
|
|
|
const files = readdirSync(testsDir)
|
|
|
|
|
.filter((f) => f.endsWith('.test.js'))
|
|
|
|
|
.sort();
|
|
|
|
|
|
|
|
|
|
let failed = 0;
|
|
|
|
|
for (const file of files) {
|
2026-04-27 12:19:53 +00:00
|
|
|
const filePath = join(testsDir, file);
|
2026-04-27 08:04:03 +00:00
|
|
|
try {
|
2026-04-27 12:19:53 +00:00
|
|
|
execFileSync('node', [filePath], { stdio: 'inherit' });
|
2026-04-27 08:04:03 +00:00
|
|
|
} catch {
|
|
|
|
|
failed++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (failed > 0) {
|
|
|
|
|
console.error(`\n${failed} test file(s) failed.`);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
console.log(`\nAll ${files.length} test files passed.`);
|