QUnit.stop()


QUnit.stop( [increment ] )

Description: Increase the number of QUnit.start() calls the testrunner should wait for before continuing.

When your async test has multiple exit points, call QUnit.stop() multiple times or use the increment argument.

Example:

A test that waits 150ms for an async operation to finish, then asserts the result.

1
2
3
4
5
6
7
8
QUnit.test( "a test", function( assert ) {
QUnit.stop();
asyncOp();
setTimeout(function() {
assert.equals( asyncOp.result, "someExpectedValue" );
QUnit.start();
}, 150 );
});