resourceloader: Fix broken code in load.php mock used to make a test fail
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 1 Mar 2018 03:28:42 +0000 (19:28 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 7 Mar 2018 20:55:23 +0000 (20:55 +0000)
commitb90bc351e3cd8d1e5e0dd7fe6f340c770201c06e
tree58434d38578c8e31fc1b6e6c694ee8c14599064e
parent870d3a6532e66ecfa1fb1127b44fed20cc152570
resourceloader: Fix broken code in load.php mock used to make a test fail

The load.mock.php has some module implementation stubs that call global
QUnit methods. This has been broken since the upgrade to QUnit 2, which removed
support for these (deprecated) methods, in favour of context-based assert.

However, this went unnoticed because these stubs are only there to make
our test fail if code is behaving incorrectly. Naturally, this isn't the
case normally. In theory, any unmerged code between QUnit 2 upgrade and now
would've failed Jenkins for something like 'QUnit.ok undefined' instead of
the more descriptive error message the stub supplies.

Fix this by instead statically exposing the contextual assert object
to the stubs.

Also centralise the clean up (teardown) for this new exposure, and also
clean up the other static exposure we have (testCallback) in the same way,
and document the cases where we intentionally clean it up inline.

Change-Id: I00b71e7bc9aa97275dfabf1070c4141fa76adb05
tests/qunit/data/load.mock.php
tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js