-
-
Notifications
You must be signed in to change notification settings - Fork 733
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
Mixed usage of setTimeout
and timers.setTimeout
#677
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
That’s interesting, I didn’t even know about Node’s timers module. I agree we should get rid of using the module. This would make a very nice first-timer issue |
…ediate When unit testing, it is not uncommon to mock the clock. This includes controlling when setImmediate fires. By using global.setImmediate, we adhere to this expectation. This also avoids consumers having to mock the timers module. Resolves #677
🎉 This issue has been resolved in version 11.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 10.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This could have been communicated better, our tests started failing after picked up 10.0.5 because most of them use fakeTimer which didn't impact Maybe update your readme with an example would help? This is a change of behaviour for all the existing tests uses fakeTimer. Those tests will start failing with no obvious error other than timing out and it would take a while to track down to the |
@Chengxuan Well articulated! I think an example would be great. We're sorry about how this inconvenienced you. |
FYI @RichardLitt more discussion have happened in #1334. |
Ah, sweet. Closing this. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you! |
🎉 This issue has been resolved in version 11.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
nock/lib/request_overrider.js
uses bothsetTimeout
andtimers.setTimeout
. Should the project use one or the other for the sake of consistency?Using
setTimeout
is nice because if a someone is mocking the clock, then nock will use a mocked clock as well. They can still do it, but have to do additional work to mocktimers
.The text was updated successfully, but these errors were encountered: