Skip to content

armgit / mocha

Public Imported from GitHub
0

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

indexOf() handles both assertions

TJ Holowaychuk1f0c36d7dc99
diff --git a/lib/runner.js b/lib/runner.js
index fff711a9..4087f8a7 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -7,6 +7,8 @@ var EventEmitter = require('events').EventEmitter
, debug = require('debug')('runner')
, Test = require('./test')
, utils = require('./utils')
+ , filter = utils.filter
+ , keys = utils.keys
, noop = function(){};
/**
@@ -465,9 +467,9 @@ Runner.prototype.run = function(fn){
*/
function filterLeaks(ok) {
- return utils.filter(utils.keys(global), function(key){
- var matched = utils.filter(ok, function(ok){
- return ok == key || 0 == key.indexOf(ok.split('*')[0]);
+ return filter(keys(global), function(key){
+ var matched = filter(ok, function(ok){
+ return 0 == key.indexOf(ok.split('*')[0]);
});
return matched.length == 0 && (!global.navigator || 'onerror' !== key);
}, this);