serverless-mocha-plugin icon indicating copy to clipboard operation
serverless-mocha-plugin copied to clipboard

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

Open icontreras-pit opened this issue 6 years ago • 2 comments

Hi guys, I need help please. I am trying to do a simple test with timeout of 30000ms, but I don't know why throw this error: Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

describe('describe 1', function () {
    it('test 1', function (done) {
        expect(200).to.be.equal(200);
        done;
    }).timeout(30000);    
});

Thanks!

icontreras-pit avatar Nov 25 '18 02:11 icontreras-pit

Make sure you have v1.10.0 minimum.

Then you can use the --timeout option. E.g. sls invoke test --timeout 10000 for 10000ms.

lsshawn avatar Nov 14 '19 05:11 lsshawn

describe('describe 1', function () {
    it('test 1', function (done) {
        expect(200).to.be.equal(200);
        done;
    }).timeout(30000);    
});

Replace done; with done();. You need to call the function.

KariHe avatar Nov 25 '19 08:11 KariHe