chai-http
chai-http copied to clipboard
chai import error
I am import chai as chaiModule, but getting error like import chaiModule from "chai"; ^^^^^^^^^^ SyntaxError: The requested module 'chai' does not provide an export named 'default'
Code for Reference
import chaiModule from "chai";
import chaiHttp from "chai-http";
const chai = chaiModule.use(chaiHttp);
describe('Users API Testing', () => {
it('GET all the users', (done) => {
chai.request('http://localhost:3000')
.get('/')
.get('/api/users')
.end((err, res) => {
if (err) done(err);
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
});
and when Import like import * as chai from 'chai', getting error - chai.request is not a function,
I tried different way to import , but getting same error.