nordcloud / serverless-mocha-plugin

Plugin for Serverless Framework which adds support for test-driven development using Mocha
MIT License
159 stars 50 forks source link

Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; #131

Open shitallakhe opened 4 years ago

shitallakhe commented 4 years ago

I am facing above error with the help of supertest and mocha. I had tried with done as well as timeout but still i facing another issue i attched my code please check and let me know ......

1. it('/LDAP/Registration',async() => { await request(app) .post('/api/v1/LDAP/Registration') .send({ "ldapregistration": { "serverhostname":"18.00.00.00", "serverport":"389", "domain":"abcd.test", "adminusername":"abcd@abcd.test", "adminpassword":"user@123", "issslselected" : "false" } } ) .set('sessionId' , accesstoken) .set('Accept', 'application/json') // .expect('Content-Type', /json/)

}).timeout(10000);

2.with the help of done it('/LDAP/Registration',(done) => { this.timeouts(300000) await request(app) .post('/api/v1/LDAP/Registration') .send({ "ldapregistration": { "serverhostname":"18.00.00.0", "serverport":"389", "domain":"abcd.test", "adminusername":"abdc@abcd.test", "adminpassword":"user@123", "issslselected" : "false" } } ) .set('sessionId' , accesstoken) .set('Accept', 'application/json') // .expect('Content-Type', /json/)

      done();

});

only error is removed by using done() but that function is not calling and code coverage also not increase