-
Notifications
You must be signed in to change notification settings - Fork 40
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
Stubbing global method (setTimeout) seems to stop test execution. #12
Comments
Is it possibly that 'setTimeout' is a bad thing to be stubbing out (and possibly used by the Blue-Ridge framework)? If so, 'doh' (on me). |
We're definitely not using setTimeout in Blue Ridge, but maybe Screw.Unit is? We'll look into it. |
Thanks! The night after I posted my comment, I noticed in John Resig's JS "Ninja" book, that he gives a simple example of a JS testing framework that uses setTimeout to queue tests. So, perhaps it is indeed in Screw.Unit. |
Does anyone have samples of testing behaviour that does take some time to complete? how do we "wait X seconds" before asserting that some behaviour has been performed? |
@drnic - Perhaps there is a better way of accomplishing this test, as JS is single-threaded. Maybe passing callback or firing an event would be better? |
i'm stuck with the same issue. i'm trying to test code that uses setTimeout and the test completes before the code is executed. does screwunit support some kind of asyn callback for testing? |
If I place the following override in a before call:
before(function(){
setTimeout = function () {print('setTimeout stub');};
});
Then, the following tests do not execute as I would expect. The first following test runs, but then all the rest of the tests do not run.
My test output looks like this:
.......start test1
.setTimeout stub
As you can see, test2 and test3 are never executed. Am I don't something wrong here?
Thanks!
The text was updated successfully, but these errors were encountered: