Skip to content

Commit

Permalink
Push a failing assertion when calling start() while already running. …
Browse files Browse the repository at this point in the history
…Resets anyway to keep other tests going. Fixes #314
  • Loading branch information
jzaefferer committed Sep 30, 2012
1 parent faee7c8 commit 8b47371
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qunit/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ QUnit = {
// ignore if start is called more often then stop
if ( config.semaphore < 0 ) {
config.semaphore = 0;
QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)" );
return;
}
// A slight delay, to avoid any current callbacks
if ( defined.setTimeout ) {
Expand Down Expand Up @@ -1048,6 +1050,8 @@ QUnit.load = function() {
}

if ( config.autostart ) {
// usually start() throws an error when called while already running (semaphore === 0)
QUnit.config.semaphore = 1;
QUnit.start();
}
};
Expand Down

0 comments on commit 8b47371

Please sign in to comment.