-
-
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 with failing after() runs suite twice #3096
Comments
Seems to happen for me no matter which hook is used ( Doesn't rerun the tests as far as I can tell, just prints the final summary/results twice -- probably some variation of #2906 (strange that there are so many different things that can cause such behavior). |
After this fix Mocha exits incorrectly if hook throws an error:
Non-zero exit status expected. |
Possible that the fix to this problem should have been done here instead? Done is done, right? Just process the event once. this.once('end', function () {
debug('end');
process.removeListener('uncaughtException', uncaught);
fn(self.failures);
}); If proposed change messes up the expected event chain (i.e., 'test end', 'suite end' never trigger), we have a major problem. Do we need a |
Prerequisites
common mistake
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.Description
With a failing test suite using the
bail
option in conjuncture with anafter
clause that throws an error.Mocha bails properly, executes the after as expected.
Then it does it all again. But Why?
Steps to Reproduce
Very simple repro steps.
File new with latest mocha.
and
yarn test, observe double suite run
remove error in after, observe one suite run
Expected behavior: [What you expect to happen]
test suite is only ran once
Actual behavior: [What actually happens]
test suite is ran twice
Reproduces how often: [What percentage of the time does it reproduce?]
100%
Versions
node node_modules/.bin/mocha --version =>
4.0.1
macOS Sierra 10.12.6
zsh
The text was updated successfully, but these errors were encountered: