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
Cannot clear timer error with sinon/mocha #872
Comments
The error message means that you have something like this in your code: var timer = setTimeout(/*...*/);
// ...
clearInterval(timer); Detecting this kind of wrong timer usage was added to the fake timer library. It's unclear to me why this happens only 50% of the time, but failing on this kind of timer usage is intentional and not a bug in Sinon. |
No instances of setTimeout or clearInterval exist in the code, it's all handled by underscore :/ |
Maybe underscore clears timers with clearInterval? |
Nope :/ There's no mention of clearInterval in the source code |
It would help a lot if you could actually make a little snippet of code displaying the issue. This does indeed seem like a bug in client code. I'd suggest firing up Chrome, setting a breakpoint at the relevant line in sinon, and see where the stack trace leads you. Re the relevant line, I'd checkout the vicinity of line 971:
|
The funny thing is this only ever shows up on CircleCI for me so I can't do that. I did a search for clearTimeout and it could be Bootstrap causing issues. So I might have cleared it by disabling it, hopefully. |
I've also encountered this and finally tracked it down: if Reproducible with mocha 4.0.1 and sinon 4.1.1 and this code under Node.js 4.5:
producing:
|
@pabigot thank you for the test case ❤️ Would you consider making a PR to fix it also? |
@mroderick, @pabigot created #1611, which I closed after moving it to sinonjs/fake-timers#138. FYI |
Fix submitted as sinonjs/fake-timers#139. |
fixes sinonjs#872 references sinonjs#1611 and sinonjs/fake-timers#138
@pabigot Thank you 👍 |
Fix released as 4.1.2 |
fixes sinonjs#872 references sinonjs#1611 and sinonjs/fake-timers#138
I'm dealing with an issue which is cropping up 50% of the time on our tests using Sinon, Mocha and Testem.
It's seemingly random all of the tests will fail starting with:
And the stack trace (even with
source-map-support
) doesn't give any clue as to what is causing the issue.The text was updated successfully, but these errors were encountered: