Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Adding filterLeaks() condition to not consider indices in global object as leaks

lodr62f2395fb34a
diff --git a/lib/runner.js b/lib/runner.js
index 43698089..7639bc75 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -530,6 +530,8 @@ Runner.prototype.run = function(fn){
function filterLeaks(ok, globals) {
return filter(globals, function(key){
+ // Firefox and Chrome exposes iframes as index inside the window object
+ if (/^d+/.test(key)) return false;
var matched = filter(ok, function(ok){
if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
// Opera and IE expose global variables for HTML element IDs (issue #243)