As chai end user, and for a Node ESM project, I install chai (5.1.1) and chai-http (4.4.0) in latest version and I'm alsways asking myself on how to do chai import statement. So I need to rely on up-to-date online chai/chai-http doc
import chaiHttp from "chai-http";
import * as chaiModule from 'chai';
const chai = chaiModule.use(chaiHttp);
const agent = await chai.request(app)
TODO:
improve chain-http readme : ✔️
ESM guide : improve provided sample ? I didn't success to import request and use it directly. My side I'm using chai.request(app) as agent then agent.request..
As chai end user, and for a Node ESM project, I install chai (5.1.1) and chai-http (4.4.0) in latest version and I'm alsways asking myself on how to do chai import statement. So I need to rely on up-to-date online chai/chai-http doc
Doc first result : https://www.chaijs.com/plugins/chai-http/
Doc ESM how to guide : https://www.chaijs.com/guide/using-chai-with-esm-and-plugins/
-> 🔴 provided example is not working (at least for me) :
import { request }, chaiHttp from 'chai-http';
My first PR (rejected because wrong repo) : https://github.com/chaijs/chaijs.github.io/pull/211
-> Correct repository is here: https://github.com/chaijs/chai-http/blob/main/README.md
Chai-http related issue : https://github.com/chaijs/chai-http/issues/313 =>related discussion - working answer https://github.com/chaijs/chai-http/discussions/315#discussioncomment-8800549
working sample
TODO:
request
and use it directly. My side I'm using chai.request(app) as agent then agent.request..