#!/usr/bin/env ts-node
// grind-tests.ts — Pre-push hook: runs flutter test
import { execSync } from 'child_process';

const RED   = '\x1b[31m';
const GREEN = '\x1b[32m';
const RESET = '\x1b[0m';

console.log('🧪 Running flutter test...');
try {
  execSync('flutter test --coverage', { stdio: 'inherit' });
  console.log(`${GREEN}✔ All tests passed${RESET}`);
} catch {
  console.error(`${RED}✘ Tests failed. Fix failing tests before pushing.${RESET}`);
  process.exit(1);
}
