From 077cf709f8f0efef4da93d28594a55ee9ffc64a9 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Thu, 20 Oct 2011 22:33:05 +0000 Subject: [PATCH] [JSTesting] Don't rely on the timeout argument of start/stop. This behavior is removed in the latest QUnit version. -- Actually, in the latest QUnit version start/stop take 'count' as first argument. It would internally set the number of wait levels to 5000 xD --- tests/qunit/data/testrunner.js | 5 +++++ .../suites/resources/mediawiki/mediawiki.test.js | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index ed7b3cdf17..8e6671ed96 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -10,6 +10,11 @@ QUnit.fixurl = function(value) { return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000); }; +/** + * Configuration + */ +QUnit.config.testTimeout = 5000; + /** * Load TestSwarm agent */ diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js index c20dcf0622..85c2472714 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.test.js @@ -131,7 +131,7 @@ test( 'mw.loader', function() { expect(1); // Asynchronous ahead - stop(5000); + stop(); mw.loader.implement( 'is.awesome', [QUnit.fixurl( mw.config.get( 'wgScriptPath' ) + '/tests/qunit/data/defineTestCallback.js' )], {}, {} ); @@ -155,9 +155,9 @@ test( 'mw.loader.bug29107' , function() { // Message doesn't exist already ok( !mw.messages.exists( 'bug29107' ) ); - // Async! Include a timeout, as failure in this test leads to neither the - // success nor failure callbacks getting called. - stop(5000); + // Async! Failure in this test may lead to neither the success nor error callbacks getting called. + // Due to QUnit's timeout feauture we won't hang here forever if this happends. + stop(); mw.loader.implement( 'bug29107.messages-only', [], {}, {'bug29107': 'loaded'} ); mw.loader.using( 'bug29107.messages-only', function() { @@ -180,9 +180,8 @@ test( 'mw.loader.bug30825', function() { base = ('//' + loc.hostname + loc.pathname).replace(/\/[^\/]*$/, ''), target = base + '/data/qunitOkCall.js?' + (new Date()).getTime(); - // Async! Include a timeout, as failure in this test leads to neither the - // success nor failure callbacks getting called. - stop(5000); + // Async! + stop(); mw.loader.load( target ); }); -- 2.20.1