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

ref(), & unref() return value #191

Closed
icebob opened this issue May 31, 2018 · 2 comments
Closed

ref(), & unref() return value #191

icebob opened this issue May 31, 2018 · 2 comments

Comments

@icebob
Copy link
Contributor

icebob commented May 31, 2018

We understand you have a problem and are in a hurry, but please provide us with some info to make it much more likely for your issue to be understood, worked on and resolved quickly.

  • Lolex version : 2.6.0
  • Environment : NodeJS v8.11

What did you expect to happen?
According to NodeJS documentation the ref() and unref() return the timer.
https://nodejs.org/dist/latest-v8.x/docs/api/timers.html#timers_timeout_ref

What actually happens
But lolex returns undefined.

How to reproduce

const lolex = require("lolex");
const clock = lolex.install();

const timer = setTimeout(() => {}, 5000).unref();
console.log(timer);
// Prints: undefined

If you comment out the lolex.install() line, it prints the NodeJS Timeout object.

Thank you!

@fatso83
Copy link
Contributor

fatso83 commented Jun 1, 2018

Grep the lolex code for unref and see what it does (or look at the code, it's just a couple of hundred lines in one file). I haven't encountered that before. Maybe we just define the function but no implementation. Wouldn't know, but I do know we accept PRs ;)

@icebob
Copy link
Contributor Author

icebob commented Jun 1, 2018

yes, I checked the code, only need to change ~2 lines. I'm making a PR.

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

No branches or pull requests

2 participants