-
-
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
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" - ESM & TS #4726
Comments
Also, I've tried to add
|
Try instead:
Or set Edit: it's not |
This is what I was missing, setting I've updated my Thank you! |
Could the usage of |
@josh-hemphill We have an example repo with an open issue on this topic. Just in case you are planning to contribute a typescript example to our example repo ... |
https://vitest.dev/guide/ just works. |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Related to #4724
I'm trying to migrate to ESM, and Mocha gives me this error:
As can be seen from Maxim-Mazurok/google-api-typings-generator@cfa158a, I've added
"require": ["ts-node/esm"]
to.mocharc.json
, using"module": "ES2020"
intsconfig.json
and"type": "module"
inpackage.json
.I've also tried
node --loader ts-node/esm ./node_modules/mocha/bin/mocha --extension ts
, which produces another error:Not sure how to solve this, and if Mocha + TS + ESM is even supposed to work. If it's supposed to work - would really appreciate any guidance, ideally reference to the working project.
Steps to Reproduce
See Readme of
esm
branch of the project for repro: https://github.com/Maxim-Mazurok/google-api-typings-generator/tree/esm (npm cit
and observe)Expected behavior: TS + ESM + Mocha works
Actual behavior: TS + ESM + Mocha results in an error
Reproduces how often: 100%
Versions
mocha --version
andnode node_modules/.bin/mocha --version
:9.1.0
,9.1.0
node --version
:v16.7.0
4.3.5
Additional Information
The text was updated successfully, but these errors were encountered: