我已经尝试了这个答案中的所有解决方案,但它们都不适合我.
我正在使用jasmine v2.3.2和jasmine-core v2.3.4
当我做这个测试时:
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);
Run Code Online (Sandbox Code Playgroud)
我在控制台上看到请求只花了3000毫秒.我甚至看到了我的got here日志.
显示超时的日志打印出来,30000而不是999999像我期望的那样.
我也通过以下消息对此测试失败:
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked …Run Code Online (Sandbox Code Playgroud)