Don't load entire codebase in QUnit tests

As noted in T160406, the only QUnit tests that requires a running
MediaWiki instance is the test for mw.popups.processLinks. The function
itself is isolated from the rest of the codebase.

Now, as noted in T162876#3182198, during boot the
ext.eventLogging.Schema module is loaded asynchronously with
mw.loader.using. Since boot is unconditional and happens ASAP this
happens when the tests are loaded and run.

In the short term this can be avoided by not making the tests depend on
the entire codebase. The long term solution is laid out in T160406.

Supporting changes:
* Bundle assets with webpack@2.4.1.

Bug: T162876
Change-Id: If1ee1853ba7a9b2a66b24bb93b4e6062b92b0dba
This commit is contained in:
Sam Smith 2017-04-14 15:29:03 +01:00
parent 83e32c255d
commit d55e8b9a17
3 changed files with 4 additions and 12 deletions

View file

@ -119,20 +119,12 @@ class PopupsHooks {
*/
public static function onResourceLoaderTestModules( array &$testModules,
ResourceLoader &$resourceLoader ) {
$localBasePath = __DIR__ . '/..';
$scripts = glob( "{$localBasePath}/tests/qunit/ext.popups/{,**/}*.test.js", GLOB_BRACE );
$start = strlen( $localBasePath ) + 1;
$scripts = array_map( function ( $script ) use ( $start ) {
return substr( $script, $start );
}, $scripts );
$testModules['qunit']['ext.popups.tests'] = [
'scripts' => $scripts,
'dependencies' => [
'ext.popups'
'scripts' => [
'tests/qunit/ext.popups/processLinks.test.js',
'src/processLinks.js',
],
'localBasePath' => $localBasePath,
'localBasePath' => __DIR__ . '/..',
'remoteExtPath' => 'Popups',
];
}

Binary file not shown.

Binary file not shown.