How can I get this test to pass without resorting to runs/waitsFor blocks?
it(\"cannot change timeout\", function(done) {
request(\"http://localhost:30
Sent pull request for this feature (https://github.com/mhevery/jasmine-node/pull/142)
it("cannot change timeout", function(done) {
request("http://localhost:3000/hello", function(error, response, body){
expect(body).toEqual("hello world");
done();
});
}, 5000); // set timeout to 5 seconds
Put it after describe
statement:
describe("A saves to DB", function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
Why not by spying on setTimeout()
?
Something like:
var spy = spyOn(window, 'setTimeout').andCallFake(function (func, timeout) {
expect(timeout).toEqual(2500);
func();
});
setTimeOut(function () { ... }, 2500);
expect(spy).toHaveBeenCalled();
Looks like you can now add it as the last argument for the it
function:
describe('my test', function(){
it('works', function(done){
somethingAsync().then(done);
}, 10000); // changes to 10 seconds
});