From: Fomafix Date: Sun, 24 Feb 2019 09:08:49 +0000 (+0100) Subject: resourceloader: Avoid global window.mwTestFooJsCounter in unit tests X-Git-Tag: 1.34.0-rc.0~2032 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=53661b3d8373c984a0635697654e4843b59fc599 resourceloader: Avoid global window.mwTestFooJsCounter in unit tests This change avoids a failure when running Special:JavaScriptTest with the option noglobals. Change-Id: Id61fca5ccedbd793f7786ad95681eaebb9feafb6 --- diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js index 8b3427f93f..ed1288b676 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js @@ -562,7 +562,8 @@ QUnit.test( '.implement( package files )', function ( assert ) { var done = assert.async(), - initJsRan = false; + initJsRan = false, + counter = 41; mw.loader.implement( 'test.implement.packageFiles', { @@ -570,9 +571,8 @@ files: { 'resources/src/foo/data/hello.json': { hello: 'world' }, 'resources/src/foo/foo.js': function ( require, module ) { - window.mwTestFooJsCounter = window.mwTestFooJsCounter || 41; - window.mwTestFooJsCounter++; - module.exports = { answer: window.mwTestFooJsCounter }; + counter++; + module.exports = { answer: counter }; }, 'resources/src/bar/bar.js': function ( require, module ) { var core = require( './core.js' );