aClever
aClever

Reputation: 11

Meteor Velocity(Jasmine unit): Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL

Here are two simple examples. No unnecessary. They do not work. Error is output to the console.

No asynchronous tests are working. These - not.

Tests write for meteor application.

About jasmine.DEFAULT_TIMEOUT_INTERVAL I already know, is the 5000.

describe("Jasmine async tests", function(){

        it("First test with timeout", function(done){
            Meteor.setTimeout(function(){
                done();
            }, 300);
        });

        it("Second test, request to google.com", function(done){
            HTTP.get("http://google.com/", {}, function(){
                done();
            });    
        });
});

Output to the console:

I20141021-21:08:35.178(3)? Async Login Test response to google.com
I20141021-21:08:35.179(3)? Error: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
I20141021-21:08:35.180(3)? at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Upvotes: 0

Views: 887

Answers (1)

Sanjo
Sanjo

Reputation: 1250

In unit test mode most of the Meteor API is stubbed out. That means that calling Meteor.setTimeout or HTTP.get will just execute an empty function and therefore will do nothing. Your callback is never called.

You can find the used stubs here: https://github.com/meteor-velocity/meteor-stubs/blob/master/index.js

Also relevant: https://github.com/Sanjo/meteor-jasmine/issues/55#issuecomment-61026304

Upvotes: 1

Related Questions