☕️ Classic, reliable, trusted test framework for Node.js and the browser
Use explicit globals, valid in strict mode
Jonas Westerlund0b467de99d2c
diff --git a/test/acceptance/globals.js b/test/acceptance/globals.jsindex 548b9d78..08cdeaa5 100644--- a/test/acceptance/globals.js+++ b/test/acceptance/globals.js@@ -19,14 +19,14 @@ describe('global leaks', function(){});it('should pass when accepted', function(){- okGlobalA = 1;- okGlobalB = 1;- okGlobalC = 1;+ global.okGlobalA = 1;+ global.okGlobalB = 1;+ global.okGlobalC = 1;})it('should pass with wildcard', function(){- callback123 = 'foo';- callback345 = 'bar';+ global.callback123 = 'foo';+ global.callback345 = 'bar';})afterEach(function(){diff --git a/test/runner.js b/test/runner.jsindex 77a428c3..c47f5bb1 100644--- a/test/runner.js+++ b/test/runner.js@@ -65,8 +65,8 @@ describe('Runner', function(){describe('.checkGlobals(test)', function(){it('should allow variables that match a wildcard', function(done) {runner.globals(['foo*', 'giz*']);- foo = 'baz';- gizmo = 'quux'+ global.foo = 'baz';+ global.gizmo = 'quux';runner.checkGlobals();delete global.foo;delete global.gizmo;@@ -75,7 +75,7 @@ describe('Runner', function(){it('should emit "fail" when a new global is introduced', function(done){runner.checkGlobals();- foo = 'bar';+ global.foo = 'bar';runner.on('fail', function(test, err){test.should.equal('im a test');err.message.should.equal('global leak detected: foo');@@ -87,8 +87,8 @@ describe('Runner', function(){it('should pluralize the error message when several are introduced', function(done){runner.checkGlobals();- foo = 'bar';- bar = 'baz';+ global.foo = 'bar';+ global.bar = 'baz';runner.on('fail', function(test, err){test.should.equal('im a test');err.message.should.equal('global leaks detected: foo, bar');