mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
42 lines
2.3 KiB
TypeScript
42 lines
2.3 KiB
TypeScript
// Filters *expected* noise off the test console so real failures stay visible
|
|
// in CI logs (a green run used to emit ~8k stderr lines, burying anything real).
|
|
// Scope is deliberately narrow: each pattern below is an artifact of the test
|
|
// environment, not of the code under test, and is matched on both the exact
|
|
// message head and the specific error. Everything else passes through verbatim
|
|
// — an unexpected migration failure or backfill error still prints.
|
|
//
|
|
// 1. `[migrations] Non-fatal migration step failed:` + `duplicate column
|
|
// name: …` — test suites build a fresh :memory: DB via createTables()
|
|
// (already-current schema) and then runMigrations() replays historical
|
|
// steps against it; some suites additionally re-run migrations on purpose.
|
|
// Unguarded ALTER TABLE steps collide with columns the current schema
|
|
// already has (which column varies by suite). Production migrates
|
|
// incrementally and never replays steps against a current schema; guarding
|
|
// the steps in src/ would change production output, so the replay artifact
|
|
// is filtered here instead. Non-duplicate-column step failures still print.
|
|
// 2. `[DB] Flight endpoint backfill failed:` + `no such table` — the backfill
|
|
// runs on application bootstrap now, so it fires in e2e TestingModules whose
|
|
// fixture DB has no reservations table. It used to be a module-eval require()
|
|
// in database.ts that vitest could not resolve at all, in ~60 files; this is
|
|
// the same suppression, narrowed to what actually still happens.
|
|
|
|
const MIGRATION_WARN_HEAD = '[migrations] Non-fatal migration step failed:';
|
|
const DUPLICATE_COLUMN = /duplicate column name: /;
|
|
|
|
const BACKFILL_ERROR_HEAD = '[DB] Flight endpoint backfill failed:';
|
|
const BACKFILL_TABLE_MISSING = /no such table/;
|
|
|
|
const errorText = (value: unknown): string => (value instanceof Error ? value.message : String(value));
|
|
|
|
const realWarn = console.warn.bind(console);
|
|
console.warn = (...args: unknown[]) => {
|
|
if (args[0] === MIGRATION_WARN_HEAD && DUPLICATE_COLUMN.test(errorText(args[1]))) return;
|
|
realWarn(...args);
|
|
};
|
|
|
|
const realError = console.error.bind(console);
|
|
console.error = (...args: unknown[]) => {
|
|
if (args[0] === BACKFILL_ERROR_HEAD && BACKFILL_TABLE_MISSING.test(errorText(args[1]))) return;
|
|
realError(...args);
|
|
};
|