当存在 2 个 expect 语句时测试超时

Test timing out when 2 expect statements present

我的 CoffeeScript 测试中有这个:

# List 1st bucket to find 1 object
.then -> 
  s3.listObjectsV2(
    Bucket: bucketName
  ).promise()

.then (data) ->
  expect(data.Contents.length).to.deep.equal(1)

# List 2nd bucket to find an empty list of objects
.then -> 
  s3.listObjectsV2(
    Bucket: bucketName2
  ).promise()

.then (data) ->
  expect(data.Contents.length).to.deep.equal(0)

此错误与 Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

如果我删除其中之一:

  .then (data) ->
    expect(data.Contents.length).to.deep.equal(1)

或:

  .then (data) ->
    expect(data.Contents.length).to.deep.equal(0)

测试通过。我觉得这与不返回 bir 的承诺有关,当两个 expect 语句都存在时导致测试失败的错误是什么?

我最后添加了:

this.timeout(5000);

测试现在通过了