-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
jasmine.clock and setTimeout inside nested promises #1282
Comments
You are more likely to get quicker responses from the community for "How to use jasmine?" questions and a history of other solutions on the jasmine-js group. We try to keep jasmine's github issues list focused on bugs and feature requests for jasmine itself. Closing. Thanks for using Jasmine! |
This actually is a bug / feature. For those who came along with same problem here is the custom solution: |
The intention behind the Jasmine clock is to make actions that are normally async (possibly with a long wait) to be run in a synchronous manner. The way it does this is by mocking out the normally async methods ( I hope this helps. Thanks for using Jasmine! |
How to use
jasmine.clock
setTimeout
mock inside nested promises? (result:Error: jasmine.DEFAULT_TIMEOUT_INTERVAL
)Order is crucial here.
I need to test nested
promise
s that must havesetTimeout
inside - order matters. I know thatthen
is kind ofprocess.nextTick
(orsetImmediate
) and it goes beyond current event loop (which is the core problem here) but this knowledge does not solve the problem :)I know that I can put
jasmine.clock().tick()
inside nested promise but this is pointless because I'm testing proper order in some events related lib.How to test something like this in jasmine? any ideas?
It looks like
jamine.clock().tick(...)
have async
nature butpromises
are async. So we are hitting a wall here?The text was updated successfully, but these errors were encountered: