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
Mocha 7: Failing async test exits mocha watch mode on reload #4143
Comments
@mantoni thanks for reporting. It's a badly written test by throwing an uncaught exception in an async scenario. Instead of calling Could you give the current |
You should follow modern async/await syntax: import util from 'util';
it('fails', async () => {
await util.promisify(setTimeout)(1);
throw new Error();
} |
@juergba I usually don't write tests like this, I'm just demonstrating the issue. I'm doing TDD with Mocha watchmode and sometimes I have a typo that causes an exception. |
@sla100 Thank you for the suggestion. You're obviously allowed to write tests the way you want. I'm not suggesting that you should adobt my testing style. I'm just demonstrating an issue here. |
@HyunSangHan thanks for testing. fixed by #4147. |
Awesome! Thanks you 💯 |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Mocha 7 exits when re-running a failing async test case.
Steps to Reproduce
Run
mocha --watch
, then touch the file to run the test again. Mocha 7 exists while mocha 6 continues to run.Expected behavior:
Mocha shows the failure and continues to watch the file for changes.
Actual behavior:
Mocha 7 exits when re-running the test. Mocha 6 shows the expected bahavior with the above test case. Mocha 7 behaves as expected for synchronous test cases.
Reproduces how often: [What percentage of the time does it reproduce?]
100%
Versions
The text was updated successfully, but these errors were encountered: