Suppose I have the following code without asyncTest
setTimeout(function(){
test ("test1", function(){
ok(true, "test1 works");
});
}, 2000);
And, this code with asynTest
asyncTest ("test1", function(){
setTimeout(function(){
ok(true, "test1 works");
start();
}, 2000);
});
My question is what are the difference between these 2? Thanks.
Taken from the qUnit documentation:
While setTimeout :
The difference is that seTimeout has nothing to do with qUnit and simple executes the specified code snippet after the specified amount of time, while qUnit’s
asyncTestdoes not execute after a specified amount of time but instead is placed on a queue from which it eventually gets picked up and executed.Also I don’t think you are really comparing like-with-like.