Imagine a test script with two tests that looks like this:
test("some test description", function(){
stop(3000); // set test timeout at 3 seconds
async_call(parameter, function(){
ok(true, "This assertion passes");
start();
});
});
test("some other test description", function(){
ok(true, "another assertion that returns true");
});
If the first test times out during async_call but it comes back later, its assertion (ok) gets run during the second test ("some other test description"). And what's worse, its call to start() *also* gets run during the next test, potentially pushing that test's assertions and start() call to the next test.
Is there a way to detect that my test has timed out so that I only call start() if I'm still "running?"