Files
MyIP/tests/setup.js
T
jason5ng32andClaude Fable 5.1 04079783af Fix(tests): keep the logger off its worker thread during specs
The pino-pretty transport runs in a worker thread. In a loaded parallel
run, a spec that logs shortly before finishing could occasionally be kept
alive by that thread and never exit, stalling the whole suite until the
CI timeout. `pnpm test` now preloads tests/setup.js, which switches the
logger to its synchronous JSON output unless LOG_FORMAT is already set.

Runtime logging is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 00:00:39 +08:00

6 lines
301 B
JavaScript

// Preloaded by `pnpm test` (node --import) before any spec. Keeps the shared
// logger off its pino-pretty worker thread: under a loaded parallel run that
// thread can keep a finished spec process from exiting. JSON output writes
// synchronously, with no worker.
process.env.LOG_FORMAT ??= 'json';