在 javascript 中使用 buster.js 进行 BDD,我有一些相当大的 API 需要测试。在某些情况下,默认超时不适合我。如何覆盖(异步)规范的默认超时?
describe("Given a request for all combinations", function() {
var scenario = null, spec;
beforeAll(function() {
scenario = scenarios.buildFakeAPI();
});
before(function(done) {
spec = this;
// *** this request can take up to 60 seconds which causes a timeout:
scenario.request({ path: "/my/request/path" }, function(err, res) {
spec.result = res;
done();
});
});
it("it should have returned the expected thing", function() {
expect(spec.result).toMatch(/expected thing/);
});
});