test(utils): skipped torn log lines in logger poll loop

- waitForLogEntry raced winston's async flush and JSON.parsed a
  partially written line, failing the error-serialization tests on
  loaded CI runners; unparseable lines now wait for the next poll.
This commit is contained in:
can1357
2026-08-03 06:52:11 +02:00
parent f41f3f3ee1
commit 5039b33a11
@@ -47,7 +47,13 @@ async function waitForLogEntry(targetMessage: string): Promise<Record<string, un
const text = fs.readFileSync(path.join(tempDir, f), "utf8");
for (const line of text.split("\n")) {
if (line.length === 0) continue;
const entry = JSON.parse(line) as Record<string, unknown>;
let entry: Record<string, unknown>;
try {
entry = JSON.parse(line) as Record<string, unknown>;
} catch {
// Torn tail of an in-flight write; the line completes on a later poll.
continue;
}
if (entry.message === targetMessage) return entry;
}
}