Skip to content

Commit

Permalink
Fixed event emitter leak. Closes #117
Browse files Browse the repository at this point in the history
tj committed Dec 4, 2011

Verified

This commit was signed with the committer’s verified signature. The key has expired.
kmbcook Kevin Cook
1 parent c1a519f commit e673963
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
@@ -159,6 +159,7 @@ Runner.prototype.hook = function(name, fn){
});

hook.run(function(err){
hook.removeAllListeners('error');
if (err) return self.failHook(hook, err);
self.emit('hook end', hook);
next(++i);

1 comment on commit e673963

@alfredwesterveld
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this error when issuing mocha -GwR min, but only one time...

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace: at EventEmitter.<anonymous> (events.js:139:15) at EventEmitter.<anonymous> (node.js:389:29) at Runner.run (/home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/lib/runner.js:428:11) at run (/home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:277:10) at /home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:222:7 at /home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:263:18 at Array.forEach (native) at load (/home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:258:9) at loadAndRun (/home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:221:5) at /home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/bin/_mocha:241:5 at StatWatcher.<anonymous> (/home/alfred/.nvm/v0.6.13/lib/node_modules/mocha/lib/utils.js:140:36) at StatWatcher.emit (events.js:70:17) at StatWatcher.onchange (fs.js:705:10)

Not using latest node.js

node -v v0.6.13

Mocha version

mocha --version 1.0.0

Please sign in to comment.