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

Latest version 2.9.26 cause mocha tests that use sinon.useFakeTimers to fail #631

Closed
demetriusnunes opened this Issue May 26, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@demetriusnunes

demetriusnunes commented May 26, 2015

My test suite uses sinon.useFakeTimers in some tests.

After the latest version bump to 2.9.26, all tests using sinon.useFakeTimers fail. Reverting back to 2.9.25 fixes the problem.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov May 26, 2015

Owner

Do you have some repro code? The last patch had nothing to do with timers

Owner

petkaantonov commented May 26, 2015

Do you have some repro code? The last patch had nothing to do with timers

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 27, 2015

It's probably 23d1b87, that changed the binding time of setImmediate which is one of the methods that sinon fakes. If you are loading sinon after Bluebird you're getting sinon's fake method now. I'm not sure setImmediate should be faked because it's more of a low-level task scheduler. See sinonjs/sinon#527 for some ways to deal with it.

dmethvin commented May 27, 2015

It's probably 23d1b87, that changed the binding time of setImmediate which is one of the methods that sinon fakes. If you are loading sinon after Bluebird you're getting sinon's fake method now. I'm not sure setImmediate should be faked because it's more of a low-level task scheduler. See sinonjs/sinon#527 for some ways to deal with it.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov May 30, 2015

Owner

@dmethvin I guess so, their documentation says nothing about setImmediate :(

Owner

petkaantonov commented May 30, 2015

@dmethvin I guess so, their documentation says nothing about setImmediate :(

dmethvin referenced this issue in jquery/jquery Jun 17, 2015

Core: Switch from modules to just window.setTimeout etc.
Using modules for window.setTimeout etc. made those functions cached and
disabled Sinon mocking, making effects tests fail. Just writing
window.setTimeout directly is smaller anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment