import { readdirSync } from 'fs'; import { execFileSync } from 'child_process'; import path from 'path'; const testsDir = path.resolve('tests'); const files = readdirSync(testsDir) .filter(f => f.endsWith('.test.ts')) .sort(); let passed = 0; let failed = 0; for (const file of files) { const filePath = path.join(testsDir, file); try { execFileSync('bun', ['test', '--bail=1', '--timeout', '30000', filePath], { stdio: 'inherit', }); passed++; } catch { failed++; } } console.log(`\n${passed + failed} test files: ${passed} passed${failed ? `, ${failed} failed` : ''}`); if (failed > 0) process.exit(1);