Skip to content

Commit

Permalink
renable tweaked start/stop; call wait on exit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
smparkes committed Oct 17, 2009
1 parent fe9f0cd commit 665485a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions bin/jquery-1.3.2-test.js
Expand Up @@ -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
Expand Down Expand Up @@ -82,3 +93,5 @@ load("build/runtest/env.js");
});

})(Envjs);

Envjs.wait(0);

0 comments on commit 665485a

Please sign in to comment.