-
Notifications
You must be signed in to change notification settings - Fork 8
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
Unable to run test due to "Error [ERR_MODULE_NOT_FOUND]: Cannot find module *.mjs" #94
Comments
I manage to resolve the issue to a certain extend, Then:
I said to a certain extends because coverage still doesn't quite work yet Here is a PR that fix the issue with running |
I am able to fix the coverage by using ts-jest following their guide on ESM Support in https://kulshekhar.github.io/ts-jest/docs/guides/esm-support I have created another PR at #96 Let me know what you think |
After inspecting Perhaps this is a no issue at all right now. The original intention was actually to make test work for #93 |
Right, I always compile the TypeScript before running tests. Is there a better way we could document that? Should we compile TypeScript as part of running the tests? That would ensure that tests always run on the compiled JS (and wouldn't even run if there were TypeScript compile errors), but it seems a bit heavy to me. |
(1)
usually it can be documented in the ### Running test
```sh
npx tsc
npm run test
``` (2)
This is reasonable. In the projects I worked with, I generally write tests to import from the source code, not from transpiled code. In my opinion, testing against transpiled JS is considered much safer. Having the test fail due to TypeScript compile error is reasonable to me too. (3) For this issue, I believe an update to the README should be sufficient. |
To be honest, I'd love to just write my tests in TypeScript, too. The main thing, in my opinion, the transpiled JS for end-users. |
Is this still an issue, given the changes in #121 ? Also, FWIW: the filenames are |
Background
Current
Expected
To be able to test
Reproduce
checkout to today's latest
npm test
The text was updated successfully, but these errors were encountered: