The project had no automated verification at all, so the "Test" step in the AGENTS.md workflow rested entirely on clicking through the app. The suite runs on bun with node:assert and adds no dependency: every file is a script that exits non-zero when a check fails, and test/run.ts runs each one in its own process. Unit tests cover the rules that decide what players see (badges, streaks, ball duty rotation, ratings, MVP ties, scouting totals, goals, notifications, CSI parsing); integration and end-to-end tests drive the real dev server. Nothing writes to the database, so both can be pointed at a live environment. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
33 lines
955 B
TypeScript
33 lines
955 B
TypeScript
/** Mini-harness condiviso: nessuna dipendenza, solo conteggio e uscita non-zero. */
|
|
|
|
const falliti: string[] = [];
|
|
let eseguiti = 0;
|
|
let saltati = 0;
|
|
|
|
export async function prova(nome: string, fn: () => Promise<void> | void) {
|
|
eseguiti += 1;
|
|
try {
|
|
await fn();
|
|
console.log(` ✓ ${nome}`);
|
|
} catch (errore) {
|
|
falliti.push(nome);
|
|
console.error(` ✗ ${nome}\n ${(errore as Error).message.split("\n")[0]}`);
|
|
}
|
|
}
|
|
|
|
export function salta(nome: string, motivo: string) {
|
|
saltati += 1;
|
|
console.log(` · ${nome} (saltato: ${motivo})`);
|
|
}
|
|
|
|
/** Da chiamare a fine file: stampa il riepilogo e imposta il codice di uscita. */
|
|
export function riepilogo(gruppo: string) {
|
|
const passati = eseguiti - falliti.length;
|
|
console.log(
|
|
`${gruppo}: ${passati}/${eseguiti} ok${saltati ? `, ${saltati} saltati` : ""}${
|
|
falliti.length ? `, falliti: ${falliti.join(", ")}` : ""
|
|
}`,
|
|
);
|
|
if (falliti.length) process.exit(1);
|
|
}
|