test(native-chat): deflake watcher rebind (#14335)

This commit is contained in:
Brennan Benson
2026-08-13 13:03:44 -07:00
committed by GitHub
parent f0c1503326
commit ee8dd4796e
@@ -33,6 +33,7 @@ vi.mock('node:fs', async () => {
import { subscribeNativeChatTranscript } from './transcript-watch'
const roots: string[] = []
const HOST_FILESYSTEM_RECONCILIATION_TIMEOUT_MS = 8_000
afterEach(async () => {
vi.useRealTimers()
@@ -205,7 +206,10 @@ describe('native chat transcript watcher liveness', () => {
await rename(root, oldRoot)
await mkdir(root)
await writeFile(filePath, claudeLine('new-file', 'user', 'after'))
await waitFor(() => replacements.mock.calls.length === 1 && watchers.length === 2)
await waitFor(
() => replacements.mock.calls.length === 1 && watchers.length === 2,
HOST_FILESYSTEM_RECONCILIATION_TIMEOUT_MS
)
await appendFile(filePath, claudeLine('new-followup', 'assistant', 'event-driven'))
watchCallbacks[1]!('change', 'transcript.jsonl')
await waitFor(() => appends.mock.calls.flat(2).some((message) => message.id === 'new-followup'))