How can I get this test to pass without resorting to runs/waitsFor blocks?
it("cannot change timeout", function(done) { request("http://localhost:3000/hello", function(error, response, body){ expect(body).toEqual("hello world"); done(); }); });
You can (now) set it directly in the spec, as per Jasmine docs.
describe("long asynchronous specs", function() { var originalTimeout; beforeEach(function() { originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; }); it("takes a long time", function(done) { setTimeout(function() { done(); }, 9000); }); afterEach(function() { jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; }); });
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With