无法为茉莉花设置超时时间

我已经在这个答案中尝试了所有的解决scheme,但没有一个为我工作。

我使用jasmine v2.3.2jasmine-core v2.3.4

当我做这个testing时:

 jasmine.DEFAULT_TIMEOUT_INTERVAL= 999999; describe('tests content controller', function(){ //... fit('/content should return 200',function(done){ request(app) .get('/content?type=script') .set('Authorization', "bearer " + requestor.token) .set('Accept', 'application/json') .expect(200) .end(function (err, res) { if (err) done.fail(err); expect(res.statusCode).toBe(200); console.log('got here'); console.log(jasmine.DEFAULT_TIMEOUT_INTERVAL); //prints 30000 done(); }) },999999); 

我在控制台上看到,请求只需要3000毫秒。 我什至看到我got herelogin。

显示超时的日志输出30000而不是像我所期望的999999

我也得到了这个testing失败的消息:

 Message: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. Stack: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. at Timer.listOnTimeout [as ontimeout] (timers.js:110:15) 1 spec, 1 failure Finished in 33.069 seconds 

有一些初始设置导致大部分延迟〜30秒。 应用程序必须连接到多个数据库,并在beforeAll中运行beforeAll函数。

我怎样才能防止茉莉花这样超时?

尝试在jasmine.DEFAULT_TIMEOUT_INTERVAL中设置beforeAll ,因为超时间隔为每个块重置:

 describe("testing timeout", function() { beforeAll(function() { jasmine.DEFAULT_TIMEOUT_INTERVAL = 999999; }); fit('should have custom timeout', function(){ console.log(jasmine.DEFAULT_TIMEOUT_INTERVAL); //prints 999999 }); }) 

另外,请记住,setTimeout使用32位整数来存储幕后的延迟,所以超过此值的整数值将导致溢出。 看到这个post: 无限茉莉花超时