javascript - Why is my jasmine unit test not waiting for 'done'? -


i have test in node application...

it('will call done', function(done) {             myobj.fn(function(){                  done();            } }); 

and code....

myobj.fn = function(success){    settimeout(2000000000,success); } 

when run test in output...

-macbook-pro:torus-pqdata user$ npm test  > torus-pqdata@0.0.0 test /stuff/code bases/2015/torus-pqdata > jasmine-node specs/ 

however can see unit test exits without failing need timeout (i trying simulate hanging). how timeout?

swap arguments in settimeout:

myobj.fn = function(success){     settimeout(success, 200000000); } 

here's reference mdn: https://developer.mozilla.org/en-us/docs/web/api/windowtimers/settimeout


Comments