-
-
Notifications
You must be signed in to change notification settings - Fork 769
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
sinon.useFakeTimers doesn't work in version 19.0.2, prior 18 version it worked #2625
Comments
I would say this works fine. Not reproducible. |
I tried this code 'use strict'; console.log(Date.now()); const clock = sinon.useFakeTimers(timeInPast); console.log(Date.now()); process.nextTick(() => { clock.tick(3001); // sinon 18 output // sinon 19 output In my case the result in a mysql query not executed. |
Ah, see that's why adding a reproduction case is important 😉 Now it makes sense. This is not a bug, but a breaking change which is implied by the semantic version increasing. If you checked out the Sinon change log you'd see the fake timer version change from 11 to 13. The one that affects you is the change where all timers are faked by default, including nextTick. See our migration guide https://sinonjs.org/guides/migration-guide for what to do. |
So the documentation may should be changed ;-) config.toFake - String[ ] - an array with explicit function names to fake. By default lolex will automatically fake all methods except process.nextTick. You could, however, still fake nextTick by providing it explicitly |
Ah, good catch! |
I guess you got it from https://sinonjs.org/releases/v19/fake-timers/. I'll update ASAP. |
The docs were out of sync with the fake-timers docs.
Is that would you would expect? |
* Fix documentation issue for fake-timers mentioned in #2625 The docs were out of sync with the fake-timers docs. * Update dependencies before new patch version
Describe the bug
const clock = sinon.useFakeTimers();
doesn't work any longer in version 19.0.2, in prior 18 version it wokred
To Reproduce
const clock = sinon.useFakeTimers();
clock.tick(1900001);
// here time is not gone by
clock.restore();
The text was updated successfully, but these errors were encountered: