From c8d2408bf2c6741dfcc8fc62b3504df4040839f8 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Fri, 21 Aug 2026 05:59:20 -0400 Subject: [PATCH] test(native-chat): prove callback error ordering --- src/main/native-chat/transcript-watch-error.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/native-chat/transcript-watch-error.test.ts b/src/main/native-chat/transcript-watch-error.test.ts index d04105bed98..368887dbcba 100644 --- a/src/main/native-chat/transcript-watch-error.test.ts +++ b/src/main/native-chat/transcript-watch-error.test.ts @@ -167,12 +167,14 @@ describe('native chat transcript watcher errors', () => { const filePath = join(root, 'transcript.jsonl') await mkdir(filePath) const snapshots: string[][] = [] + let errorCallbackCount = 0 const subscription = await subscribeNativeChatTranscript({ agent: 'claude', sessionId: 'session', filePath, onInitialSnapshot: (messages, _hasMore, _beforeOffset, error) => { if (error) { + errorCallbackCount += 1 throw new Error('subscriber is closing') } snapshots.push(messages.map((message) => message.id)) @@ -183,6 +185,7 @@ describe('native chat transcript watcher errors', () => { }) try { + await vi.waitFor(() => expect(errorCallbackCount).toBe(1)) await rm(filePath, { recursive: true, force: true }) await writeFile(filePath, claudeLine('u-recovered-after-throw', 'user', 'back')) await vi.waitFor(() => expect(snapshots).toContainEqual(['u-recovered-after-throw']))