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

Time travel without freezing #85

Closed
jvdp opened this issue Oct 21, 2016 · 7 comments
Closed

Time travel without freezing #85

jvdp opened this issue Oct 21, 2016 · 7 comments

Comments

@jvdp
Copy link

jvdp commented Oct 21, 2016

I'd like to use this library for acceptance tests (ie. running the web app + JS frontend in a browser / phantomjs) that involve time-dependent data, so the clock needs to be set back to a certain date. My app also uses lodash' debounce function, however, which relies on the passage of time. Because I don't really have a good place to put a tick statement the clock shouldn't be 'frozen' at a particular moment but it should advance as normal from the system date specified.

This would like the travel method of Timecop.js (which is deprecated in favor of sinon / lolex.)

@fatso83
Copy link
Contributor

fatso83 commented Jan 15, 2017

I don't see how this could be implemented without async behaviour, which means you just might as well just put tick calls in some endless setInterval or process.nextTick loop yourself.

@jvdp
Copy link
Author

jvdp commented Jan 16, 2017

We can take a timestamp of when time travel starts and then compute the difference to determine the adjust "current" time. Timecop.js does this: https://github.com/jamesarosen/Timecop.js/blob/master/lib/TimeStackItem.js

@fatso83
Copy link
Contributor

fatso83 commented Jan 16, 2017

True, just computing the nowvalue based on the diff is easily done. Such a feature should be quite easily implemented. Must have been to late to think clearly 😄 Care to take a stab at it?

@jvdp
Copy link
Author

jvdp commented Jan 26, 2017

Will see what I can do.

@mroderick
Copy link
Member

Has this issue stalled?

@fatso83
Copy link
Contributor

fatso83 commented Jun 28, 2017

Will be closed by #102

@fatso83
Copy link
Contributor

fatso83 commented Jul 14, 2017

closed by #102

@fatso83 fatso83 closed this as completed Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants