☕️ Classic, reliable, trusted test framework for Node.js and the browser
Fixed --globals with wildcard
TJ Holowaychuk7a44adac50c0
diff --git a/lib/runner.js b/lib/runner.jsindex d60a97f7..5446e7e6 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -472,7 +472,8 @@ Runner.prototype.run = function(fn){function filterLeaks(ok) {return filter(keys(global), function(key){var matched = filter(ok, function(ok){- return 0 == key.indexOf(ok.split('*')[0]);+ if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);+ return key == ok;});return matched.length == 0 && (!global.navigator || 'onerror' !== key);});diff --git a/test/acceptance/globals.js b/test/acceptance/globals.jsindex f0768147..548b9d78 100644--- a/test/acceptance/globals.js+++ b/test/acceptance/globals.js@@ -24,6 +24,11 @@ describe('global leaks', function(){okGlobalC = 1;})+ it('should pass with wildcard', function(){+ callback123 = 'foo';+ callback345 = 'bar';+ })+afterEach(function(){// uncomment to test// foo = 'bar'diff --git a/test/mocha.opts b/test/mocha.optsindex c21bcdd3..92162fa2 100644--- a/test/mocha.opts+++ b/test/mocha.opts@@ -4,4 +4,5 @@--growl--globals okGlobalA,okGlobalB--globals okGlobalC+--globals callback*--timeout 200