☕️ Classic, reliable, trusted test framework for Node.js and the browser
renamed check_global_leaks to something more js-like
Tj Holowaychuke8629c90eedc
diff --git a/bin/mocha b/bin/mochaindex b43f1583..ed441d27 100755--- a/bin/mocha+++ b/bin/mocha@@ -176,8 +176,7 @@ function run(suite) {var runner = new Runner(suite);var reporter = new Reporter(runner);runner.globals(program.globals);- if(program.leaks)- runner.check_global_leaks = false;+ if (program.ignoreLeaks) runner.ignoreLeaks = true;if (program.grep) runner.grep(new RegExp(program.grep));if (program.growl) growl(runner, reporter)runner.run();diff --git a/lib/runner.js b/lib/runner.jsindex ceecb9ea..2ece55b9 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -41,7 +41,6 @@ function Runner(suite) {this.on('hook end', function(hook){ self.checkGlobals(hook); });this.grep(/.*/);this.globals(Object.keys(global).concat(['errno']));- this.check_global_leaks = true}/**@@ -85,9 +84,8 @@ Runner.prototype.globals = function(arr){*/Runner.prototype.checkGlobals = function(test){- if(!this.check_global_leaks){- return;- }+ if (this.ignoreLeaks) return;+var leaks = Object.keys(global).filter(function(key){return !~this._globals.indexOf(key);}, this);diff --git a/test/globals.js b/test/globals.jsindex d72de386..6ba173cc 100644--- a/test/globals.js+++ b/test/globals.js@@ -21,8 +21,6 @@ describe('global leaks', function(){it('should pass when accepted', function(){okGlobalA = 1;okGlobalB = 1;- foo = 'test';- bar = 'test';})afterEach(function(){diff --git a/test/mocha.opts b/test/mocha.optsindex e0c094ec..47b43e92 100644--- a/test/mocha.opts+++ b/test/mocha.opts@@ -3,4 +3,3 @@--ui bdd--growl--globals okGlobalA,okGlobalB---leaks