Mocked fetch throws a DOMException when executing with an already aborted signal
valeriobelli opened this issue · 0 comments
Hi all!
While executing tests in one of my private repositories, I've seen a weird behaviour which differs from the expected behaviour of native fetch.
When executing the fetch
function with an already aborted signal, normalizeRequest
(https://github.com/jefflau/jest-fetch-mock/blob/master/src/index.js#L123-L142) throws a DOMException
. However, since this function is synchronous, the Error bubbles up without having the chance to intercept its failure with a rejected Promise
as it happens with the native implementation. As you can imagine, the result is failing tests.
I'm wondering: is it intended behaviour?
Here, you can find a repo with the reproduction step of what I intend. I've put both the expected and unexpected behaviours.
I am available to help you.