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

UseFakeTimers and issue with Async library #561

Closed
danielkcz opened this issue Sep 5, 2014 · 3 comments
Closed

UseFakeTimers and issue with Async library #561

danielkcz opened this issue Sep 5, 2014 · 3 comments

Comments

@danielkcz
Copy link

This is coming from here ... caolan/async#609

I have tried to explain that issue is not anything that Sinon can solve. Am I wrong or is there any other option?

@cjohansen
Copy link
Contributor

You can do useFakeTimers(0, "setTimeout", "clearTimeout") to specify which functions to fake. Default is all of them. However, I agree that async could avoid this on behalf of their users with var tick = setImmediate; somewhere in their initialization code.

@cjohansen
Copy link
Contributor

...and the same with setTimeout, because for scheduling issues, they never want to use anything other than what the environment provides. I do also agree that it doesn't make much sense for a library like async to actively distrust the global environment. However, this is a very common situation, and caching the needed properties seems like a pragmatic approach in my opinion.

@danielkcz
Copy link
Author

Thanks, I have missed these options, perfect.

Having this option is half of the solution thou. As I said in that thread and @rlidwka somewhat denies it, for people who doesn't know where to look, they could hardly figure out that Async is using setImmediate in such weird way.

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