Skip to content
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

Support timeout.refresh in node environments #187

Closed
SimenB opened this issue May 22, 2018 · 11 comments
Closed

Support timeout.refresh in node environments #187

SimenB opened this issue May 22, 2018 · 11 comments
Labels

Comments

@SimenB
Copy link
Member

SimenB commented May 22, 2018

  • Lolex version : 2.6.0
  • Environment : Node.js macOS
  • Example URL : N/A
  • Other libraries you are using: N/A

What did you expect to happen?
clock.setTimeout(() => {}, 0).refresh should exist.

(as it's not released I didn't really expect that, but y'know.)

See nodejs/node#20298, which is slated to land in 10.2.0.

What actually happens
It's not there

How to reproduce
Create a clock in a node env, call setTimeout, observe missing refresh function on return value.

@benjamingr
Copy link
Member

So basically it should do clearTimeout and then setTimeout?

@SimenB
Copy link
Member Author

SimenB commented May 23, 2018

Yeah, I think that makes sense.

Have to keep around old timeouts as well, but maybe that's done already? Keeping a weak reference might be overkill

@benjamingr
Copy link
Member

@SimenB do you feel like making a PR?

Otherwise - I might have time to take a look at this when I'm back from the Node.js summit.

@benjamingr
Copy link
Member

This was fixed in #193 🎉

@SimenB
Copy link
Member Author

SimenB commented Jun 11, 2018

The function was added, but it has no logic. Should it?

@benjamingr
Copy link
Member

@SimenB technically it probably should (even if through just a clearTimeout and setTimeout) - but I doubt anyone is going to use the two features together for some time. I can reopen if you'd like.

@jpenglert
Copy link

@SimenB I have an existing test that broke when I refactored from clearTimeout()/setTimeout() to Timer.refresh() because the fake Timer.refresh() does not call clearTimeout()/setTimeout(). Any plans to add that logic?

@SimenB
Copy link
Member Author

SimenB commented Nov 23, 2019

PR very much welcome 🙂

@SimenB
Copy link
Member Author

SimenB commented Nov 23, 2019

I'll reopen this since we don't actually support it, it's just a noop

@SimenB SimenB reopened this Nov 23, 2019
@stale
Copy link

stale bot commented Jan 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@benjamingr
Copy link
Member

Fixed in #328 , we need a release, it'll be a few days before I'll be in front of a computer with npm credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants