Skip to content

Commit c0bb33d

Browse files
Don’t load Tainted References during QUnit tests
Apparently this causes problems during the QUnit tests, because they want all code to be loaded before starting to run any of it, but here we’re lazily loading additional ResourceLoader modules. I don’t think we have any QUnit tests for tainted refs, so it’s probably fine to skip loading the module in that case. Bug: T330293 Change-Id: I44ff7c2bdd10680b71d453025d4a449cec5cc49e
1 parent 171ef70 commit c0bb33d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

view/resources/wikibase/view/ControllerViewFactory.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,13 @@ wikibase.view.ControllerViewFactory = ( function ( wb ) {
202202

203203
// dynamically load wikibase.tainted-ref, originally added as dependency of this module in change I9a244a36fe (commit 5fed25ce15);
204204
// it’s not directly related to ControllerViewFactory, but we want to load it at the same time,
205-
// and the dependency can’t be in resources.php because then TR’s es6-ness “infects” regular Wikibase (T298001)
206-
mw.loader.using( 'wikibase.tainted-ref' ).catch( function () {
207-
// ignore errors (but avoid unhandled promise rejection)
208-
} );
205+
// and the dependency can’t be in resources.php because then TR’s es6-ness “infects” regular Wikibase (T298001);
206+
// however, don’t load TR during QUnit tests, we don’t need it there and it causes problems (T330293)
207+
if ( !window.QUnit ) {
208+
mw.loader.using( 'wikibase.tainted-ref' ).catch( function () {
209+
// ignore errors (but avoid unhandled promise rejection)
210+
} );
211+
}
209212

210213
return SELF;
211214

0 commit comments

Comments
 (0)