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

timers does not work with Date.now in IE8 #31

Closed
arian opened this issue Aug 4, 2011 · 1 comment
Closed

timers does not work with Date.now in IE8 #31

arian opened this issue Aug 4, 2011 · 1 comment

Comments

@arian
Copy link

arian commented Aug 4, 2011

When you use a polyfill for Date.now, like MooTools or ES5-shim does, the fake timer does not work in (native) IE8.
Probably it's because Sinon.JS feature checks if Date.now is available, but the polyfill is loaded after Sinon.JS is loaded.

Example: http://jsfiddle.net/arian/dhEbb/2/

Don't know if an exception can be made so when useFakeTimer is used, it will check if Date.now exists, or perhaps implementing Date.now anyway (so removing this check: https://github.com/cjohansen/Sinon.JS/blob/master/lib/sinon/util/fake_timers.js#L222), which works for me too.

@cjohansen
Copy link
Contributor

I guess the right thing to do is to check for the existence of Date.now when useFakeTimers is called, as you suggested. In the meantime, you can get around this by loading Sinon after you have loaded the external library that defines Date.now.

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