jest-runner-mocha
jest-runner-mocha copied to clipboard
EventEmitter memory leak
I have a big project with 5000+ tests, and I receive warning:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 501 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit
The problem lies within node_modules/jest-runner-mocha/build/runMocha.js
mocha.addFile(testPath);
var onEnd = function onEnd() {
process.on('exit', function () {
return process.exit();
});
};
Without babel, it looks like
const onEnd = () => {
process.on('exit', () => process.exit());
};
Seems like an exit listener is being added for every test file. It looks very suspicious and can possibly be a memory leak too.
Also, I don't understand the meaning of this - exiting in exit does not make sense to me...