-
Notifications
You must be signed in to change notification settings - Fork 108
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
Missing information in documentation about shouldAdvanceTime #390
Comments
Spent some time looking into this to understand what was going on. Pasted my runnable experiment here: I merged this feature (#102) 4 years ago in 3775a00, but I never really used it myself, so I was a bit unfamiliar with it and have long since forgotten how it is implemented, but you are indeed right in that it implicitly relies on stubbing setInterval. I am not totally sure why, though, as it seems like it only calls through to the real/original version, so the |
Fix in place. PR coming up |
See if #391 does not fix your issue.
|
Did not hear back, but this should make the actual implementation be in line with the docs, so no doc update needed 😄 |
#102) lolex can now attach itself to the system timers and automatically advance mocked time at a certain 'real' interval - changed uninstall signature to carry over configuration flags in cases where this might be necessary - updated shouldAdvanceTime functionality to support new install method signature - moved time delta parameter to config * Updated Readme.md and History.md
@fatso83 Thanks for looking into it and creating a PR in such short time. |
I am using fake-timers for some time now and I wanted to utilize the
shouldAdvanceTime
option.But I did not get it to work from the start.
This was my install code;
According to the documentation, this should work. Set
shouldAdvanceTime
to true and it will use the default time delta of 20ms. However, it would not work. The fake timer was not advancing automatically.I had to look through the source to see that it actually also expects
setInterval
andclearInterval
to be faked too.I'm not sure why the advanceTime needs set and clearInterval to be faked too, but it was not expected.
If it is needed, could you change the documentation to reflect that the
setInterval
andclearInterval
are needed for this option to work?The text was updated successfully, but these errors were encountered: