From d55e8b9a17e3df7bb34d7a7d6bd4619b4ec34b54 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Fri, 14 Apr 2017 15:29:03 +0100 Subject: [PATCH] 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 --- includes/PopupsHooks.php | 16 ++++------------ resources/dist/index.js | Bin 120558 -> 120564 bytes resources/dist/index.js.map | Bin 154715 -> 154727 bytes 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/includes/PopupsHooks.php b/includes/PopupsHooks.php index 3429187a1..662b6bf0d 100644 --- a/includes/PopupsHooks.php +++ b/includes/PopupsHooks.php @@ -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', ]; } diff --git a/resources/dist/index.js b/resources/dist/index.js index 406e43e4ed594e93b5365253d9df8c1df552401a..7e800f14ee04a5a7d2aa19185e71a2fe51b69702 100644 GIT binary patch delta 30 mcmaF2mi^0G_6_=sObXSL^%)&l6gW9+oAVjB=QA?aUj+cBEeY)a delta 30 ocmV+(0O9}itq1O{2e2;zlbIGclhXnhli(I}gZBZq_W=R@)YjMz8~^|S diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index 2d76f0e93cac780dae9c19311682ed0eb38eaeec..686cd27c362aad1edafab9fd2be57676e8b7290a 100644 GIT binary patch delta 55 zcmV-70LcH_xC!UD39t?alh9WqlQ26LlfYLHla>l0vvdbvTLd6`TyB#qZ8HWSTy$J? NeS-*Nw+LeaQ~6mA6j%TN delta 51 zcmV-30L=gAxCz_139t?alaMYCldvfelduU9laLAplRzmElbZ@4vv>zzTa(#hHG>pm Jw-jRmQ~3e26FvX{