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

Exitos

I have the test in my node application...

it('will call done', function(done) {
            myObj.fn(function(){

                done();
           }
});

and the code....

myObj.fn = function(success){
   setTimeout(2000000000,success);
}

When I run the test I get this in the output...

-MacBook-Pro:torus-pqdata user$ npm test

> [email protected] test /Stuff/code bases/2015/torus-pqdata
> jasmine-node specs/

However as you can see the unit test just exits without failing but I need it to timeout (I am trying to simulate something hanging). How do I get it to timeout?

jojo

Swap the arguments in setTimeout:

myObj.fn = function(success){
    setTimeout(success, 200000000);
}

Here's some reference from MDN: https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

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

From Dev

Jasmine unit test skipped by my Karma configuration

From Dev

Why is my variable undefined in my Jasmine test - Jasmine.js

From Dev

Why is my variable undefined in my Jasmine test - Jasmine.js

From Dev

Why is my deferred.done() waiting for an AJAX call not resolved?

From Dev

TypeError Unit Test Jasmine

From Dev

Jasmine unit tests not waiting for promise resolution

From Dev

Why is my jasmine test failing for my Angular app

From Dev

Why is my JSONObject related unit test failing?

From Dev

Jasmine Unit Test with postMessage and addEventListener

From Dev

$httpBackend in AngularJs Jasmine unit test

From Dev

AngularJS controller unit test with Jasmine

From Dev

Unit Test for Login with Jasmine and Karma

From Dev

Jasmine unit test module is not defined

From Dev

How do I do a jasmine unit test for my angular directive that needs to test its emit?

From Dev

Why my AngularJS async test in Jasmine 1.3.x is not working?

From Dev

Test asynchronous functionality in Jasmine 2.0.0 with done()

From Dev

Why won't $scope be found in my AngularJS / Karma unit test?

From Dev

why my unit test failing after adding a parameter?

From Dev

why my unit test failing after adding a parameter?

From Dev

why my failing Ruby Unit Test does not fail?

From Dev

Why does my Interceptor Fail in a Weld SE unit test?

From Dev

Why does my unit test fail when I refactor

From Dev

How Unit test coverage is actually done?

From Dev

Unit test service that returns promise Angularjs Jasmine

From Dev

Jasmine Unit Test Angular-Cookie

From Dev

Jasmine unit test case for $routeChangeStart in AngularJS

From Dev

How to unit test a chained method using Jasmine

From Dev

angularjs unit test karma with jasmine mock dilemma

Related Related

  1. 1

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

  2. 2

    Jasmine unit test skipped by my Karma configuration

  3. 3

    Why is my variable undefined in my Jasmine test - Jasmine.js

  4. 4

    Why is my variable undefined in my Jasmine test - Jasmine.js

  5. 5

    Why is my deferred.done() waiting for an AJAX call not resolved?

  6. 6

    TypeError Unit Test Jasmine

  7. 7

    Jasmine unit tests not waiting for promise resolution

  8. 8

    Why is my jasmine test failing for my Angular app

  9. 9

    Why is my JSONObject related unit test failing?

  10. 10

    Jasmine Unit Test with postMessage and addEventListener

  11. 11

    $httpBackend in AngularJs Jasmine unit test

  12. 12

    AngularJS controller unit test with Jasmine

  13. 13

    Unit Test for Login with Jasmine and Karma

  14. 14

    Jasmine unit test module is not defined

  15. 15

    How do I do a jasmine unit test for my angular directive that needs to test its emit?

  16. 16

    Why my AngularJS async test in Jasmine 1.3.x is not working?

  17. 17

    Test asynchronous functionality in Jasmine 2.0.0 with done()

  18. 18

    Why won't $scope be found in my AngularJS / Karma unit test?

  19. 19

    why my unit test failing after adding a parameter?

  20. 20

    why my unit test failing after adding a parameter?

  21. 21

    why my failing Ruby Unit Test does not fail?

  22. 22

    Why does my Interceptor Fail in a Weld SE unit test?

  23. 23

    Why does my unit test fail when I refactor

  24. 24

    How Unit test coverage is actually done?

  25. 25

    Unit test service that returns promise Angularjs Jasmine

  26. 26

    Jasmine Unit Test Angular-Cookie

  27. 27

    Jasmine unit test case for $routeChangeStart in AngularJS

  28. 28

    How to unit test a chained method using Jasmine

  29. 29

    angularjs unit test karma with jasmine mock dilemma

HotTag

Archive