summaryrefslogtreecommitdiff
path: root/tests/qunit/data/testrunner.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qunit/data/testrunner.js')
-rw-r--r--tests/qunit/data/testrunner.js40
1 files changed, 19 insertions, 21 deletions
diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js
index db312b21..03aaf4af 100644
--- a/tests/qunit/data/testrunner.js
+++ b/tests/qunit/data/testrunner.js
@@ -26,32 +26,20 @@
*/
// When a test() indicates asynchronicity with stop(),
- // allow 10 seconds to pass before killing the test(),
+ // allow 30 seconds to pass before killing the test(),
// and assuming failure.
- QUnit.config.testTimeout = 10 * 1000;
+ QUnit.config.testTimeout = 30 * 1000;
+
+ QUnit.config.requireExpects = true;
// Add a checkbox to QUnit header to toggle MediaWiki ResourceLoader debug mode.
QUnit.config.urlConfig.push( {
id: 'debug',
label: 'Enable ResourceLoaderDebug',
- tooltip: 'Enable debug mode in ResourceLoader'
+ tooltip: 'Enable debug mode in ResourceLoader',
+ value: 'true'
} );
- QUnit.config.requireExpects = true;
-
- /**
- * Load TestSwarm agent
- */
- // Only if the current url indicates that there is a TestSwarm instance watching us
- // (TestSwarm appends swarmURL to the test suites url it loads in iframes).
- // Otherwise this is just a simple view of Special:JavaScriptTest/qunit directly,
- // no point in loading inject.js in that case. Also, make sure that this instance
- // of MediaWiki has actually been configured with the required url to that inject.js
- // script. By default it is false.
- if ( QUnit.urlParams.swarmURL && mw.config.get( 'QUnitTestSwarmInjectJSPath' ) ) {
- jQuery.getScript( QUnit.fixurl( mw.config.get( 'QUnitTestSwarmInjectJSPath' ) ) );
- }
-
/**
* CompletenessTest
*
@@ -256,6 +244,7 @@
},
teardown: function () {
+ var timers;
log( 'MwEnvironment> TEARDOWN for "' + QUnit.config.current.module
+ ': ' + QUnit.config.current.testName + '"' );
@@ -272,9 +261,18 @@
// Check for incomplete animations/requests/etc and throw
// error if there are any.
if ( $.timers && $.timers.length !== 0 ) {
- // Test may need to use fake timers, wait for animations or
- // call $.fx.stop().
- throw new Error( 'Unfinished animations: ' + $.timers.length );
+ timers = $.timers.length;
+ // Tests shoulld use fake timers or wait for animations to complete
+ $.each( $.timers, function ( i, timer ) {
+ var node = timer.elem;
+ mw.log.warn( 'Unfinished animation #' + i + ' in ' + timer.queue + ' queue on ' +
+ mw.html.element( node.nodeName.toLowerCase(), $(node).getAttrs() )
+ );
+ } );
+ // Force animations to stop to give the next test a clean start
+ $.fx.stop();
+
+ throw new Error( 'Unfinished animations: ' + timers );
}
if ( $.active !== undefined && $.active !== 0 ) {
// Test may need to use fake XHR, wait for requests or