2016-12-27 96 views
0

消息:我得到超时 - 异步回调不被jasmine.DEFAULT_TIMEOUT_INTERVAL出错指定的超时时间内调用

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 ontimeout (timers.js:365:14) 
     at tryOnTimeout (timers.js:237:5) 
     at Timer.listOnTimeout (timers.js:207:5) 
+0

我们需要您的代码和说明...请添加,否则此问题将被删除 –

回答

1

增加茉莉默认的时间间隔。您将以下代码添加到conf.js文件。

代码:

jasmineNodeOpts: { 
     showColors: true, 
     includeStackTrace: true, 
     defaultTimeoutInterval: 1440000 
    } 
1

jasmine.DEFAULT_TIMEOUT_INTERVAL是时间milisecs是茉莉花等待一个it块抛出一个超时错误之前的时期。

超时错误可能是您的代码中出现问题的迹象,或者只是需要更多时间运行。作为另一个答案所述,您可以增加全球茉莉花超时间隔,或者对于一个测试,这样设置超时时间:

const myTestTimeout: number = 2 * 60 * 1000; //explicitly set for readabilty 

it('should validate something', (() => { ...your test code }), myTestTimeout); 

我的方法是增加超时针对特定测试,让你确定测试有足够的时间(例如3分钟)。如果测试再次失败,则可以确定错误的原因是代码中的问题。

相关问题