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

Underscore's stores Date.now(), and Lolex cannot replace it #47

Closed
danny-wu opened this issue Apr 1, 2016 · 0 comments
Closed

Underscore's stores Date.now(), and Lolex cannot replace it #47

danny-wu opened this issue Apr 1, 2016 · 0 comments

Comments

@danny-wu
Copy link

danny-wu commented Apr 1, 2016

Underscore 1.6.0 to 1.8.3 stores Date.now, mandating Date.now to be stubbed before loading Underscore for fake clocks to work. Affected functions include _.debounce, _.throttle, and probably more.

This is an issue with Underscore, not Lolex. Lolex can work around this by replacing Date.now upon installation, but this will end up faking Dates created before installation and end up breaking other, more valid, uses.

Underscore no longer uses Date.now in master, and lodash seems to work as well. This issue is just here for informational purposes.

@danny-wu danny-wu changed the title Date.now() is incremented after setTimeouts have run. Underscore's stores Date.now(), and Lolex cannot replace it Apr 1, 2016
@danny-wu danny-wu closed this as completed Apr 1, 2016
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

1 participant