mswjs / msw

Seamless REST/GraphQL API mocking library for browser and Node.js.
https://mswjs.io
MIT License
15.28k stars 479 forks source link

intercepted request won't abort on node 20 w/ msw@1.3.3 #2184

Open gerbyzation opened 2 weeks ago

gerbyzation commented 2 weeks ago

Prerequisites

Environment check

Node.js version

v20.6.1

Reproduction repository

https://github.com/gerbyzation/msw-node20-undici-fetch-abort-repro

Reproduction steps

Setup:

git clone https://github.com/gerbyzation/msw-node20-undici-fetch-abort-repro
cd msw-node20-undici-fetch-abort-repro
pnpm i

To demonstrate the abort doesn't work with an MSW handler, but does work without run the two scripts below:

node not-working-abort.mjs
node working-abort.mjs

Current behavior

Request completes without throwing an abort error

Expected behavior

fetch should throw an abort error