我正在获取超时-在jasmine指定的超时内未调用异步回调。默认\u超时\u间隔错误

我正在获取超时-在jasmine指定的超时内未调用异步回调。默认\u超时\u间隔错误,jasmine,Jasmine,信息: 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_INTER

信息:

   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)

增加jasmin默认时间间隔。将以下代码添加到conf.js文件中

代码:

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

jasmine。默认超时时间间隔
是jasmine在抛出超时错误之前等待单个
it
块的时间段,单位为毫秒

超时错误可能是代码中出现错误或运行时间过长的标志。如另一个答案所述,您可以增加全局Jasmine超时时间间隔,或者对于单个测试,按如下方式设置超时:

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

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

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

将此添加到karma.conf.js

module.exports=函数(配置){
config.set({
客户:{
茉莉花:{
是的,
种子:“4321”,
真的,
failFast:没错,
时间间隔:1000
}
}
})

}
我们需要您的代码和说明。。。请加上这个,否则这个问题就是deletedHi,除了加一个超时,还有其他的解决方案吗?