QUnit: Ensure test modules are top loading
authorTimo Tijhof <ttijhof@wikimedia.org>
Tue, 2 Apr 2013 17:59:07 +0000 (19:59 +0200)
committerKrinkle <ttijhof@wikimedia.org>
Tue, 2 Apr 2013 20:33:52 +0000 (20:33 +0000)
Jenkins tests for extensions were exiting with a false positive.
They were marked "success" but in fact were wrong because
it only ran the core tests, the extensions' test suite was
loaded after QUnit already stopped listening.

Change-Id: I164d60e06118b64a1c6a17665a0fb1faeff744e5

includes/resourceloader/ResourceLoader.php
tests/qunit/QUnitTestResources.php

index 62c0822..589a354 100644 (file)
@@ -287,6 +287,10 @@ class ResourceLoader {
                // Add the testrunner (which configures QUnit) to the dependencies.
                // Since it must be ready before any of the test suites are executed.
                foreach( $testModules['qunit'] as $moduleName => $moduleProps ) {
+                       // Make sure all test modules are top-loading so that when QUnit starts
+                       // on document-ready, it will run once and finish. If some tests arrive
+                       // later (possibly after QUnit has already finished) they will be ignored.
+                       $testModules['qunit'][$moduleName]['position'] = 'top';
                        $testModules['qunit'][$moduleName]['dependencies'][] = 'mediawiki.tests.qunit.testrunner';
                }
 
index 01072d8..36fdbcc 100644 (file)
@@ -61,6 +61,5 @@ return array(
                        'mediawiki.language',
                        'mediawiki.cldr',
                ),
-               'position' => 'top',
        )
 );