-
-
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
Two running instances of Mocha in Watch mode hang on first change detection #3404
Comments
On macOS, it is fine. I should check it on Windows. Could you provide mcve? |
The reason seems to be the massive change injection of webpack-emit-all-plugin. I think mocha can't handle a lot of changes in a short time. With two instances the problem occure just faster. Same with one instance but after the n-th compilation. 1. Just try setting up a slow test suite so that Mocha is killed after the first changes due to further changes. 1. it('t', async function(done) {
this.timeout(2500);
setTimeout(() => done, 2000);
}); 2. const fs = require('fs');
let i = 0;
setInterval(() => {
fs.writeFile('./test.js', `const a = ${i++}`, () => {});
}, 10); // <- Adjust if too aggressive
setTimeout(() => process.exit(0), 3000); or maybe fs.writeFile(`./test${i}.js`, `const a = ${i++}`, () => {}); Solution
This problem can not be associated only with Webpack. The same behavior could also occur with babel or other compilers that produce many changes in the observed directory. |
Looks like you're generating files to be tested. Did you attempt to make use of |
The watch feature has been refactored completely using |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.Description
Two running instances of Mocha in Watch mode hang on first change detection. Startup execution work as expected in both instances. Both instances just print 0 passing without failure prints. No Global instance of Mocha installed. Both instances in independent node_module directories.
Steps to Reproduce
package.json:
shell:
Expected behavior: [What you expect to happen]
Execute both instances as expected
Actual behavior: [What actually happens]
Two running instances of Mocha in Watch mode hang on first change detection.
Both instances just print 0 passing without failure prints.
Reproduces how often: [What percentage of the time does it reproduce?]
Versions
mocha --version
andnode node_modules/.bin/mocha --version
:5.2.0
node --version
:v9.4.0
Windows 7 64
The text was updated successfully, but these errors were encountered: