Skip to content
Browse files

clear both timeouts when the tests complete or timeout

  • Loading branch information...
1 parent 132e6e5 commit 807536dd2cc1e877c6c99b7008ee5b63d2944af8 @johnbender johnbender committed
Showing with 9 additions and 6 deletions.
  1. +9 −6 tests/unit/runner.js
View
15 tests/unit/runner.js
@@ -13,11 +13,17 @@
// establish a timeout for a given suite in case of async tests hanging
var testTimer = setTimeout( function(){
// prevent any schedule checks for completion
- clearTimeout( checkTimer );
+ clearTimeouts();
start();
}, testTimeout ),
- checkTimer = setInterval( check, checkInterval );
+ checkTimer = setInterval( check, checkInterval ),
+
+ clearTimeouts = function(){
+ // prevent the next interval of the check function and the test timeout
+ clearTimeout( checkTimer );
+ clearTimeout( testTimer );
+ };
// check the iframe for success or failure and respond accordingly
function check(){
@@ -34,10 +40,7 @@
// if we have a result check it, otherwise check back shortly
if( result ){
ok( result === "qunit-pass" );
-
- // prevent the next interval of the check function and the test timeout
- clearTimeout( checkTimer );
- clearTimeout( testTimer );
+ clearTimeouts();
start();
}
};

0 comments on commit 807536d

Please sign in to comment.
Something went wrong with that request. Please try again.