-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
🐛 Bug: Hit an error with CJS named exports #5156
Comments
Fix CommonJS named export error in esm-utils (Issue mochajs#5156)
I can't figure out how to get these tests to run in the repro. After
...then if I add
Could you please post an isolated reproduction that I can quickly get running on my end, please? |
You should run:
However, I see the same errors with chai types recently and have created an issue here: chaijs/chai-http#334 |
👍 that worked for me, thanks. Interestingly, those specific errors go away if we switch the absolute - import { Database } from "infrastructure"
+ import { Database } from "../../infrastructure" ...but are replaced with equivalents from
These still happen if I npx mocha -r ts-node/register The change in #5160 does not fix the Anyway, for the If you can make a minimal isolated reproduction (https://antfu.me/posts/why-reproductions-are-required#reproducible-projects-or-playgrounds) that shows an issue in Mocha, that'd be helpful. But given that we have multiple working examples in https://github.com/mochajs/mocha-examples of TypeScript code, I'm going to close this for now as userland misconfiguration. Thanks for filing! ☕ |
I changed the |
The original problem reported in this post surfaces with chaijs/chai-http#334 resolved.
Attempting to import using
I guess the question is how to import non-default exported symbols from another workspace using |
At this point, it looks like this is more of a help request / general question, not an issue in Mocha to be fixed. So I'll say this isn't the right medium to ask. You'd be better off on somewhere like StackOverflow or our Discord. |
I still believe it is a problem with
|
W.r.t https://github.com/mochajs/mocha-examples/tree/main/packages/typescript I tried
No previous error but no test is run at all. |
Bug Report Checklist
faq
label, but none matched my issue.Expected
No runtime error
Actual
I have the following
src/infrastructure/db.ts
file:and
src/infrastructure/index.ts
:This file is referenced in
src/webapi/routes/api.ts
and hit the following error using rollup:Minimal, Reproducible Example
https://github.com/khteh/Node.JSRestAPI
Versions
Mocha: 10.4.0
Node: 22.2.0
Additional Info
npm run start
does not hit this error.The text was updated successfully, but these errors were encountered: