-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Bug]: useFakerTimers and fetch/XHR do not seem to work #13018
Comments
Did you try playing with |
Hey @mrazauskas , thank you for your suggestions. I tried them out and played with the values a bit, but they don't seem to do the trick |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Bumping it in order to not be auto-closed |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This is still an issue |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
28.1.2
Steps to reproduce
yarn install
yarn test
Expected behavior
I expected to see all the tests pass.
Actual behavior
Tests that use
useFakeTimers
failAdditional context
I tried a while to come up with a minimal reproduction case. However, to rule out any libraries like
node-fetch
,whatwg-fetch
and so on, I also created a failing example withXMLHttpRequest
.Additionally, I tried to see if
setTimeout
works withuseFakeTimers
within a React component, and it seems to work.Basically, what I observed, is that as soon as I start using
useFakeTimers
, requests (fetch/XHR) are not being sent, as if something is blocking them. Even runningjest.runAllTimers()
did not do the trick. Now I'm wondering if this is the expected behaviour, and if yes, maybe someone can shed some light here for me, as I'm really trying to understand that behaviour. When I digged a bit intonode-fetch
orwhatwg-fetch
, I saw that they worked withsetTimeout
andPromise
, so in my eyes, whenever I runadvanceTimersByTime
,runAllTimer
orrunOnlyPendingTimers
, it should run those requests, but it doesn't.Environment
The text was updated successfully, but these errors were encountered: