Javascript 使用带量角器的摩卡咖啡超时无法使测试失败

Javascript 使用带量角器的摩卡咖啡超时无法使测试失败,javascript,testing,mocha.js,protractor,performance-testing,Javascript,Testing,Mocha.js,Protractor,Performance Testing,我在摩卡网站上找到了,然后我们可以设置它阻止的超时时间,但看起来它对我不起作用 describe('something', function () { this.timeout(500); it('should take less than 500', function (done) { setTimeout(done, 500); browser.get('#/dashboard'); }); }) 运行结果: something

我在摩卡网站上找到了,然后我们可以设置它阻止的超时时间,但看起来它对我不起作用

describe('something', function () {
    this.timeout(500);
    it('should take less than 500', function (done) {
        setTimeout(done, 500);
        browser.get('#/dashboard');
    });
})
运行结果:

something
  √ should take less than 500 <9849>
什么 √ 应该少于500分钟 是否可以获取实际测试超时并进行比较? 或者我应该使用expect()使测试失败


感谢您提前提供任何建议。

我在我的exports.config中发现了问题:

  mochaOpts: {
    reporter: 'good-mocha-html-reporter',
    slow: 5000,
    enableTimeouts: true
  }
};

enableTimeouts处于false状态。

您还可以为每个it设置不同的超时,这样会覆盖exports.config值-

it('应少于500',功能(完成){
设置超时(完成,500);
browser.get(“#/dashboard”);
},500);