You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.
Description
Runner does not clean up event listeners on global objects.
ℹ [mocha] waiting for changes...
(node:18921) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18921) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit
Runner.prototype.dispose is never called in watchmode.
Reproduces how often: [What percentage of the time does it reproduce?]
Every time after the ~10th run
Versions
The output of mocha --version and node node_modules/.bin/mocha --version:
The output of node --version: 14.4.0
Your operating system
name and version: Ubuntu 18.04
architecture (32 or 64-bit): 64 bit
Your shell (e.g., bash, zsh, PowerShell, cmd): fish
Your browser and version (if running browser tests): N/A
Any third-party Mocha-related modules (and their versions): no
Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): no
Additional Information
The event handlers are attempted to be removed in prepare:
That doesn't have any effect after instantiation since this.uncaught is different between each runner instance. Whatever constructs the Runner instance also needs to call dispose. Might be better if the Runner took care of it e.g. with this.once('end', () => this.dispose()) in the constructor.
The text was updated successfully, but these errors were encountered:
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Runner
does not clean up event listeners on global objects.Steps to Reproduce
https://github.com/eps1lon/mocha-event-leak
Expected behavior: [What you expect to happen]
Removes all event listeners when destroyed.
Actual behavior: [What actually happens]
Event listeners on
process
leak:Runner.prototype.dispose
is never called in watchmode.Reproduces how often: [What percentage of the time does it reproduce?]
Every time after the ~10th run
Versions
mocha --version
andnode node_modules/.bin/mocha --version
:node --version
: 14.4.0Additional Information
The event handlers are attempted to be removed in
prepare
:mocha/lib/runner.js
Lines 1063 to 1064 in 7e490aa
That doesn't have any effect after instantiation since
this.uncaught
is different between each runner instance. Whatever constructs theRunner
instance also needs to calldispose
. Might be better if theRunner
took care of it e.g. withthis.once('end', () => this.dispose())
in theconstructor
.The text was updated successfully, but these errors were encountered: