When using bail flag, before hook failures do not exit as failed #3303
Labels
status: accepting prs
Mocha can use your help with this one!
type: bug
a defect, confirmed by a maintainer
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.Description
When using the bail flag before hook failures do not exit the test as a failure.
Steps to Reproduce
sample test:
command:
output:
Although its hard to see here, the test is exiting with a 0 code. You can see it better by running:
The
echo 'hello'
should never get hit but it does.Similarly, running this without
--bail
works as expected, the process exits with a non-zero code:output:
Note: Regardless of before block structure this bug still occurs
Expected behavior: Test should fail if there is an error in before hook
Actual behavior: Test does not fail
Reproduces how often: 100%
Versions
mocha v5.0.5 global and local (tested version 4 through 5 and 5.0.5 seems to be the only affected version)
macOS
zsh
Additional Information
Related to: #3096
The text was updated successfully, but these errors were encountered: