mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
"Kiro stream errors become Responses response.failed events" drove the transform with `new Response(transform.readable).text()`. That cannot observe the contract it is asserting: createStreamFailureAborter forwards the translated failure event and then errors the controller on purpose, so a translated upstream error never ends as a clean, successful-looking stream (the sibling tests in stream-passthrough-error-redaction and stream-utils pin exactly that). `.text()` discards the forwarded bytes and rejects, `await writer.close()` threw ERR_INVALID_STATE first, and the abandoned `.text()` rejection surfaced as an unhandledRejection after the test ended. Drive it the way production does instead — `pipeThrough` plus a reader, the same shape as collectUntilFailure() in the sibling suite. The forwarded event is kept (a pending read is fulfilled before the error resets the queue) and the deliberate termination is now asserted rather than tripped over. All four original assertions are unchanged; the termination assertion is added. Production code is untouched: `pipeThrough` marks its internal pipeTo promise handled, so the abandoned rejection never existed off the test bench. 6/6 green.