Skip to content

Commit

Permalink
Merge pull request #2181 from JustATrick/fix-check-leaks
Browse files Browse the repository at this point in the history
fix check-leaks to catch a leak whose name begins with 'd'
  • Loading branch information
boneskull committed Aug 28, 2016
2 parents 0aa932b + a419b9f commit 1605548
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 9 additions & 0 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit 1605548

Please sign in to comment.