From 665485a885c45acdd87bf8ee4dc749a0f3a5dcb6 Mon Sep 17 00:00:00 2001 From: Steven Parkes Date: Fri, 16 Oct 2009 20:25:05 -0700 Subject: [PATCH] renable tweaked start/stop; call wait on exit A few changes 1) restore the start/stop (old code only stopped once, otherwise the suite would stop early) 2) make a default timeout (since a few tests crash and otherwise freeze everything) 3) pull the timeout code into test the qunit code binds start in a closure, so it isn't overriden by the one here, so we pull it out and do it outselves --- bin/jquery-1.3.2-test.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/bin/jquery-1.3.2-test.js b/bin/jquery-1.3.2-test.js index 1a0145ef..0dd08ddc 100644 --- a/bin/jquery-1.3.2-test.js +++ b/bin/jquery-1.3.2-test.js @@ -36,19 +36,30 @@ load("build/runtest/env.js"); var unsafeStop = stop, unsafeStart = start, isStopped = null; - - stop = function(){ - if(isStopped === null || !isStopped === false){ + + var config_timeout; + stop = function(timeout){ + if(isStopped === null || isStopped === false){ $env.log('PAUSING QUNIT'); isStopped = true; - unsafeStop(arguments); + unsafeStop.call(this); + timeout = ( timeout && timeout > 0 ) ? timeout : 10000; + if (timeout) + config_timeout = setTimeout(function() { + QUnit.ok( false, "Test timed out" ); + start(); + }, timeout); } }; start = function(){ if(isStopped === null || isStopped === true ){ $env.log('RESTARTING QUNIT'); isStopped = false; - unsafeStart(arguments); + if(config_timeout) { + clearTimeout(config_timeout); + config_timeout = undefined; + } + unsafeStart.call(this); } }; //we know some ajax calls will fail becuase @@ -82,3 +93,5 @@ load("build/runtest/env.js"); }); })(Envjs); + +Envjs.wait(0); \ No newline at end of file