-
-
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
Bail flag causes before() hooks to be run even after a failure #1812
Comments
+1 (really looks like bug) |
Can it be fixed in some way? |
Bug confirmed, thanks for reporting. I couldn't really look at the cause so far. |
I've found a fix for this that passes the tests and I can submit a PR. I'm not exactly sure how to simulate the multiple it and before blocks for the purposes of adding a test for the fix though. |
@aaroncrows This can be helpful: https://github.com/mochajs/mocha/blob/master/test/integration/helpers.js Usage example: https://github.com/mochajs/mocha/blob/master/test/integration/multiple.done.js Let us know if you need further help/pointers. :) |
Example file:
So what I'm seeing is that when you run this with
--bail
and the first test fails, it keeps going and runs all the other hooks before actually quitting. The output looks like this:In our actual code base we have hundreds of test suites each with sometimes lengthy hooks that set up and tear down fixtures in the db. When you run the whole suite with
-b
, you might see one red dot, and then it appears to hang for over a minute while it is running all the other hooks. Finally it reports with the failure. I can't think of why this would be desirable, so my best guess is that it is a bug.The text was updated successfully, but these errors were encountered: