【问题标题】:Why does this.timeout have no effect when running an async test with mocha and pogo?为什么在使用 mocha 和 pogo 运行异步测试时 this.timeout 没有效果?
【发布时间】:2014-07-07 12:07:15
【问题描述】:

我正在使用PogoScript 和 mocha 来测试一些进行异步调用的代码。

我需要增加超时时间,但我的代码不起作用。我尝试使用this.timeout(5000)self.timeout(5000) 无效。

it 'runs some async code'
  self.timeout(5000)
  result = request!('some params')
  expect(result).to.be.true

【问题讨论】:

    标签: asynchronous mocha.js pogoscript


    【解决方案1】:

    对于普通函数,在块前使用=> 运算符让调用者(在本例中为mocha)定义self

    it 'runs some async code' =>
      self.timeout(5000)
      result = request!('some params')
      expect(result).to.be.true
    

    更多信息请参见Pogoscript#Self

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-05
      • 1970-01-01
      • 2012-06-29
      • 2020-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多