Skip to content
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

EventEmitter memory leak #21

Open
jehy opened this issue Jan 28, 2020 · 0 comments
Open

EventEmitter memory leak #21

jehy opened this issue Jan 28, 2020 · 0 comments

Comments

@jehy
Copy link

jehy commented Jan 28, 2020

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...

jehy added a commit to jehy/jest-runner-mocha-next that referenced this issue Jan 28, 2020
jehy added a commit to jehy/jest-runner-mocha-next that referenced this issue Jan 28, 2020
jehy added a commit to jehy/jest-runner-mocha-next that referenced this issue Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant