Mocha与Mongoose,async,等待

时间:2018-01-22 09:35:51

标签: mongoose async-await mocha

我使用mocha进行测试,当使用async / await时,我得到了

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

我的代码

describe('ClientsMerge', () => {

    it('it should get all clients', async () => {
let clients = await Client.find();
console.log(clients);
    });

});

1 个答案:

答案 0 :(得分:1)

您可能需要的是增加摩卡测试的超时

例如:

mocha src/**/*.test.js --timeout 15000