Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么我的jasmine测试在默认的超时时间间隔之前超时?_Javascript_Node.js_Jasmine_Supertest - Fatal编程技术网

Javascript 为什么我的jasmine测试在默认的超时时间间隔之前超时?

Javascript 为什么我的jasmine测试在默认的超时时间间隔之前超时?,javascript,node.js,jasmine,supertest,Javascript,Node.js,Jasmine,Supertest,相关的: Jasmine 2.4.1 我的测试报告由于超时而失败,即使超时值似乎大于报告的时间 我正在这样做: describe('tests content controller', function(){ beforeAll(function(done) { jasmine.DEFAULT_TIMEOUT_INTERVAL= 120000; //... }) fit('/content GET should return 200',fu

相关的:

Jasmine 2.4.1

我的测试报告由于超时而失败,即使超时值似乎大于报告的时间

我正在这样做:

describe('tests content controller', function(){
    beforeAll(function(done) {
        jasmine.DEFAULT_TIMEOUT_INTERVAL= 120000;
        //...
    })
    fit('/content GET should return 200',function(done){
        request(app)
        .get('/content')
        .set('Authorization', "bearer " + requestor.token)
        .set('Accept', 'application/json')
        .expect(200)
        .end(function (err, res) {
            console.log('timeout',jasmine.DEFAULT_TIMEOUT_INTERVAL); //prints 120000
            if (err) done.fail(err);
            expect(res.statusCode).toBe(200);
            done();
        })
    }); 
然后该测试失败,出现以下情况:

1) tests content controller /content GET should return 200
  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)


Finished in 106.449 seconds
106.449秒小于120秒,这是我的超时值设置的值


那么为什么这个测试失败了呢?

我之前没有在我的
中调用
done
,这导致了这个错误。

@engineer执行
getEnv()
方法会导致打印超时的
console.log
。将
beforeach
更改为
beforeach
没有帮助