test(sweep): reset console-prefix's stdout redirect in the shared afterEach — the ENG-5 serve harness leaks it across files (#4061)

runServe()'s stdio path flips console-prefix's module-global
stdout→stderr redirect (#3844). bun test runs every file in one
process, so after sweep.test.ts's serve-wiring tests the flag stays
on and any later file pinning slog's stdout routing fails
(test/sync-all-parallel.test.ts, test/console-prefix.test.ts) —
shard-composition dependent, so it surfaces as a flake. Same reset
the donor harness (test/serve-stdio-lifecycle.test.ts) already
carries.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
paul-0320
2026-08-13 04:13:40 -07:00
committed by GitHub
co-authored by Claude Fable 5
parent 1ec6a6e842
commit 3ce296e315
+9
View File
@@ -22,6 +22,7 @@ import {
} from '../src/core/sweep.ts';
import { isTotalFailure, runSweep, SWEEP_HELP } from '../src/commands/sweep.ts';
import { currentExitCode, _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';
import { _resetStdoutRedirectForTests } from '../src/core/console-prefix.ts';
import type { CapabilityReport } from '../src/core/capability.ts';
import { __setChatTransportForTests, type ChatResult } from '../src/core/ai/gateway.ts';
import { runServe, type ServeOptions } from '../src/commands/serve.ts';
@@ -68,6 +69,14 @@ beforeEach(async () => {
afterEach(() => {
__setChatTransportForTests(null);
// The ENG-5 harness drives the real runServe(), whose stdio path flips
// console-prefix's module-global stdout→stderr redirect (#3844). bun runs
// every test file in one process, so without this reset the flag stays on
// and poisons any later file that pins slog's stdout routing
// (test/sync-all-parallel.test.ts, test/console-prefix.test.ts) — whether
// it bites depends on CI shard composition. Same reset the donor harness
// (test/serve-stdio-lifecycle.test.ts) already carries.
_resetStdoutRedirectForTests();
});
async function seedPage(slug: string, type: string, body: string, timeline = '') {