-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Callback for timed out async call run for different test #2190
Comments
By default, mocha will run individual hooks/specs sequentially. If you need some logic to be ran sequentially, have you tried taking advantage of the before/after hooks? |
Thanks. I see that the test files are run sequentially, but after a timeout is hit from an async call, mocha moves on to the next test and subsequent test files. When the async call from the first test returns (long after timeout period) its callback is executed for a different test (which happened to be in a different file). |
Can you give an example of a spec with such a callback? I think the issue could be solved by either retuning the promise within the spec/hook, or only invoking the spec's callback when that async logic terminates. E.g. // You might have
it('test', function(done) {
someAsyncCall();
done();
});
// You should instead do
it('test', function(done) {
someAsyncCall(function(err, res) {
assert(!err);
// other assertions
done();
});
}); |
Please see this:
When running
We probably have a bigger problem, having a slow api in the first place. |
@deepakmani I think I need to see more code. I can tell you that you need to check This sounds somewhat similar to #2315, which was recently fixed |
Setting aside multiple files and just focusing on multiple tests, is this an accurate demonstration of the issue? (FWIW, on both Mocha 2.x and Mocha 3.x it outputs this for me:)
|
Maybe I encounted the same problem. In my repo EVEModX/login-server@a5d2400 I got a timed out in |
I am a bot that watches issues for inactivity. |
Hi,
We are running mocha and need to wait for one test file to be done before the next one is run.
For example
A related stack overflow post is here:
http://stackoverflow.com/questions/26027890/running-two-different-test-files-sequentially-in-mocha
Thanks,
Deepak
The text was updated successfully, but these errors were encountered: