-
-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax error in ESM import examples in docs #1628
Comments
I think the docs are just slightly ahead of where the code is. Our mistake (i.e the docs got updated but the code didn't yet) The latter is correct for now - importing and using the In future, Also the deprecation notice is correct, we should update our main field to include a file extension. Contributions welcome 🙏 |
Any update ? i got the exact same issue here Update - not exactly a solution but downgrading it to 4.5.0 works for me |
https://github.com/chaijs/chai-http?tab=readme-ov-file#application--server as per the updated readme, it should be this seems clear from the readme, so maybe we just need a notice somewhere to tell you and others it has changed. do you have any suggestions for how this would've been easier to find? |
Yup same issue as I commented here as well: #1578 (comment) |
yes it certainly is the current readme for chai-http is correct (as it says to use we should probably update it to recommend somewhere down the line, the types are wrong it seems. I'll take a look in your screenshot of |
Importing chai mocha in current state is just a hell. No matter how i try to import it, it will certainly throw breaking errors.
In the docs, it is stated that when using ESM modules, that we need to use this kind of import statements:
How is that correct syntax? I cannot import chai like that. (Yes i have ESM enabled)
Now if i import it like this,
Then it throws the
TypeError: chai.request is not a function
error and also a deprecation warning:(node:7452) [DEP0151] DeprecationWarning: Package \xxcensoredxx\node_modules\chai-http\ has a "main" field set to "./index", excluding the full filename and extension to the resolved file at "index.js", imported from \xxcensoredxx\test\user.test.js. Automatic extension resolution of the "main" field is deprecated for ES modules. (Use
node --trace-deprecation ...to show where the warning was created)
The text was updated successfully, but these errors were encountered: