-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
TypeError: Unknown file extension ".ts" | #71
Comments
the same |
same here! |
same problem |
"loader=ts-node/esm" need to be added to the node-option in the mocha configuration .mocharc.json
|
This question comes from Chat.js 5.x, using 4.x will solve that. |
it was related to chai in probably your example |
I added esm to my command by loader=ts-node/esm, but now I'm getting typescript error which doesn't exist. |
As of #76, we now have at least two working examples of using TypeScript with recent tools. You can see `packages/typescript-ts-node-esm-loader. Cheers! ☕ |
In the example, package.json -> type is equal to module, but we weren't using that, which means it is a commonjs. The project doesn't work with module. Can you give an example where the package.json type is equal to commonjs? @JoshuaKGoldberg |
|
After only removing "type" property in package.json, it did not work. Here is
node version: v21.6.2, npm version: 10.2.4 But I changed the file extensions to .mts and changed the imports etc accordingly. It now works with this configuration. |
This is rapidly descending into becoming a support thread, which GitHub issues on an examples repo are not well suited for. Your best bet would be to ask in one of Mocha's support forums: the Mocha Discord's |
package.json
tsconfig.json
.mocharc.json
Greetings, I am unable to run mocha when including
import { expect } from 'chai';
into my project.It causes the following to occour.
I am not sure what to do to solve this? I followed the guidance of the following video along with the TS example project.
Video
Project
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: