Open normanzb opened 4 years ago
Is there a scenario where it is useful for mocha to continue watching here rather than quit? A lot has changed since v6 and the expected behaviour when no test files are found is to exit the current process, regardless of watch mode.
🤔 I can see an argument that Mocha being run in watch mode is an indication it's meant as a long-lived development utility. As in, you might start it, then write your tests.
cc @mochajs/maintenance-crew - I think we can consider this a bug and accepting PRs. What do you think?
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Mocha 7 quits watching process when the test folder is deleted
Steps to Reproduce
npm i mocha@7.0.1 -D
./node_modules/.bin/mocha --watch
rm -r test
test.js file:
Expected behavior: [What you expect to happen] Mocha continues to watching newly added files if any, mocha doesn't quit the process.
Actual behavior: [What actually happens]
Mocha 7 quits with error message: "Error: No test files found: "test"" This is not an issue in mocha@6.
Reproduces how often: [What percentage of the time does it reproduce?] 100%
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 7.0.1node --version
: v13.3.0Additional Information