Replies: 2 comments 1 reply
-
Calling If my PR is merged it will allow to expose a method on the server to abort all pending requests. server.close()
server.listen(...)
// or a new method
server.abortRequests() I just submitted another PR that fixes the issue with the |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jonyo Did you ever find a solution for this? Presumably the aborted request would close its connection, so could there be some way to detect that early termination? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I couldn't find anything mentioning ways to test abort signals using
AbortController
and passing insignal
in thefetch
options.I tried testing a timeout by using
ctx.delay(100)
in the returned response, it did seem to delay the response but the timeout did not kick in (or did not have any effect). I added console logs, the timeout function which calledabortController.abort()
was called before the response came back but it seemed to be ignored by MSW.The other side is testing that previous request gets cancelled successfully. We have something that cancels the previous request if the filters for the request change before the response is received (think of a user interacting with search filters and they make additional changes before the previous results come back).
Is it even possible to test
signal
behavior and cancelling a request early with MSW?Beta Was this translation helpful? Give feedback.
All reactions