Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Replaces % with *

Nathan Bowser5b687ea47d39
diff --git a/lib/runner.js b/lib/runner.js
index a55de90e..614101c1 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -115,7 +115,7 @@ Runner.prototype.checkGlobals = function(test){
if (this.ignoreLeaks) return;
var leaks = utils.filter(utils.keys(global), function(key){
var matched = utils.filter(this._globals, function(allowed){
- return allowed == key || key.lastIndexOf(allowed.split('%')[0], 0) == 0;
+ return allowed == key || key.lastIndexOf(allowed.split('*')[0], 0) == 0;
});
return matched.length == 0 && (!global.navigator || 'onerror' !== key);
}, this);
diff --git a/mocha.js b/mocha.js
index a6168f5e..e0c3856f 100644
--- a/mocha.js
+++ b/mocha.js
@@ -3197,7 +3197,7 @@ Runner.prototype.checkGlobals = function(test){
if (this.ignoreLeaks) return;
var leaks = utils.filter(utils.keys(global), function(key){
var matched = utils.filter(this._globals, function(allowed){
- return allowed == key || key.lastIndexOf(allowed.split('%')[0], 0) == 0;
+ return allowed == key || key.lastIndexOf(allowed.split('*')[0], 0) == 0;
});
return matched.length == 0 && (!global.navigator || 'onerror' !== key);
}, this);
diff --git a/test/runner.js b/test/runner.js
index ba911e8a..0a219353 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -47,7 +47,7 @@ describe('Runner', function(){
describe('.checkGlobals(test)', function(){
it('should allow variables that match a wildcard', function(done) {
- runner.globals(['foo%', 'giz%']);
+ runner.globals(['foo*', 'giz*']);
foo = 'baz';
gizmo = 'quux'
runner.checkGlobals();