diff --git a/lib/runner.js b/lib/runner.js index f19a4060eb..8831c8e1cb 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -892,7 +892,7 @@ function hasOnly(suite) { function filterLeaks(ok, globals) { return filter(globals, function(key) { // Firefox and Chrome exposes iframes as index inside the window object - if (/^d+/.test(key)) { + if (/^\d+/.test(key)) { return false; } diff --git a/test/runner.js b/test/runner.js index 37aeb22d6f..6168bb3e34 100644 --- a/test/runner.js +++ b/test/runner.js @@ -179,6 +179,15 @@ describe('Runner', function(){ }); runner.checkGlobals(test); }) + + it('should emit "fail" when a global beginning with d is introduced', function(done) { + global.derp = 'bar'; + runner.on('fail', function(test, err){ + delete global.derp; + done(); + }); + runner.checkGlobals('im a test'); + }); }) describe('.hook(name, fn)', function(){