Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions test/audit-fixes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ describe("audit pass 1 — Retry-After parsing (Bug 8)", () => {

describe("audit pass 1 — TimeoutError carries the configured timeout (Bug 18)", () => {
it("error.timeout reflects the option, not 0", async () => {
// The contract under test is the *shape* of the error (carries the
// configured `timeout` option, message includes "25ms"), not the wall-clock
// behavior of `AbortSignal.timeout`. Driving the rejection synchronously
// with a TimeoutError-named DOMException exercises the same
// `mapTransportError` path while removing the real-timer race that flaked
// under saturated CI runners (issue #120).
const driver = {
name: "slow",
request: (req: Request) =>
new Promise<Response>((_resolve, reject) => {
req.signal?.addEventListener("abort", () => reject(req.signal!.reason), { once: true })
}),
request: (_req: Request) =>
Promise.reject(new DOMException("The operation timed out.", "TimeoutError")),
}

const m = createMisina({ driver, retry: 0, timeout: 25 })
Expand All @@ -86,7 +90,7 @@ describe("audit pass 1 — TimeoutError carries the configured timeout (Bug 18)"
throw err
}
}
}, 3000)
})
})

describe("audit pass 1 — HTTPError.data is parsed during retry (Bug 16)", () => {
Expand Down
Loading