-
Notifications
You must be signed in to change notification settings - Fork 108
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 breaks test when used with native callbacks #66
Comments
as I check this issue occur with tape. mocha works as expected. feel free to close the issue if you think there is nothing to do with lolex to solve this. I'll share my solution here if I find any. |
I know that Mocha keeps a reference to setTimeout for it's own use, specifically to allow stubbing it in tests. Maybe tape doesn't do that and relies on setTimeout internally? |
it is true. it depends(calls process.nextTick - which uses setTimeout to shim) only when doing async execution(xhr calls, browser native async operations, events that executed in async but not relevant with time). calling clock.tick(1) after assertion solves this problem(this where process.nextTick is called) but this is a quite ugly solution. the problem with test is, assertions works fine but tab output is never ended and this makes karma test to timeout. following lines are relevant with this |
I'll use lolex directly with createClock() and make my class accept a clock interface to not mess with global settings by using useFakeTimers(). this looks like the cleanest way to do it. |
Closing this as this is a tape issue. Follow tape-testing/tape#292 for updates or file a PR there to see it fixed. |
@ilgooz : I filed an issue with |
@fatso83 yes thanks. :') |
Test timeouts when I do have callbacks for native events in my code. removing fake timer from code makes it work again.
Chrome 50.0.2661 (Linux 0.0.0)
thank you
The text was updated successfully, but these errors were encountered: