| 356 | |
| 357 | it('synthesizes results then rethrows when the source stream throws', async () => { |
| 358 | async function* failing(): AsyncIterable<OpencodeStreamEvent> { |
| 359 | yield session |
| 360 | yield { |
| 361 | kind: 'event', |
| 362 | event: { |
| 363 | type: 'message.part.updated', |
| 364 | properties: { |
| 365 | part: { |
| 366 | id: 'p-c', |
| 367 | sessionID: 'sess-1', |
| 368 | type: 'tool', |
| 369 | callID: 'call-7', |
| 370 | tool: 'bash', |
| 371 | state: { status: 'running', input: {} } as never, |
| 372 | }, |
| 373 | }, |
| 374 | }, |
| 375 | } |
| 376 | throw new Error('aborted') |
| 377 | } |
| 378 | |
| 379 | const chunks: Array<StreamChunk> = [] |
| 380 | await expect(async () => { |