diff --git a/packages/trae/stream.test.mjs b/packages/trae/stream.test.mjs index da9fe33..58943e2 100644 --- a/packages/trae/stream.test.mjs +++ b/packages/trae/stream.test.mjs @@ -148,7 +148,9 @@ test("a reply cut at its limit says length", async () => { test("a stream that breaks off ends with an error and [DONE]", async () => { // the connection breaks only once the caller has the first event, so the // plugin has read it: a reset timed by the clock alone can beat that read - // on a busy machine, and Bun then drops the event it had (#124) + // on a busy machine, and Bun then drops the event it had (#124). The fake + // breaks it by stopping its server mid-body, not by erroring the body: + // Bun prints a body's error on every run, and that read as a red (#268) let reset const caught = new Promise((r) => (reset = r)) f = fakeTrae() @@ -158,7 +160,7 @@ test("a stream that breaks off ends with an error and [DONE]", async () => { async pull(ctl) { if (n++ === 0) return ctl.enqueue(new TextEncoder().encode('event: output\ndata: {"response":"half"}\n\n')) await caught - ctl.error(new Error("connection reset")) + f.close() }, }) return new Response(body, { headers: { "content-type": "text/event-stream" } })