-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Invalid state: ReadableStream is locked error from fetch-mock router when combining AbortSignal.timeout and recursive retries #845
Comments
Hello 👋 Just getting round to looking at this now. Which version of jest are you on? I'm not able to get the test to fail, but I do keep getting flaky tests relating to abort in CI which have been around for ages and I'm not too sure why |
Here's an example of a failed test run https://app.circleci.com/pipelines/github/wheresrhys/fetch-mock/1065/workflows/d8562eee-0ff3-4dc2-8fde-14a9df91f744/jobs/11161 |
Hey, thanks for taking a look! Sorry I should have said, I haven’t managed to create a minimal case for this causing an actual test failure either, I just get the error logged: https://app.circleci.com/pipelines/github/wheresrhys/fetch-mock/1061/workflows/9adf68aa-c9f8-4964-81af-94c738765f31/jobs/11125?invite=true#step-102-1871_50 In my own test suite, for reasons I haven’t yet managed to establish, this error does seem to cause a failure. I was hoping (and it’s a reasonably confident hope) that if we can get to the bottom where this error is logged from, this will fix my failing test in my own codebase |
Reading here https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/locked I don't understand much more But I have a hunch that [your |
Could you check out this #847, run |
Hm nope I get the same error, this time from the call to |
Hello old friend 👋 Struggling to say for sure if this a user error or if I’ve stumbled upon an edge case.
I’m writing tests in jest, mocking globally, using node 18, and node native fetch.
Scenario:
Please see the test case in this PR: #844. Let me know if there’s any other info I can provide.
I've been working around this issue by explicitly creating an AbortController and setting a timeout to fire the signal and manually cancelling it after the promise resolves
The text was updated successfully, but these errors were encountered: