-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Cannot Import TypeScript Module In Test File #1002
Comments
use ts-node/register/transpile-only instead
|
@ljsustainas That works, but it seems to disable type-checking when running the tests. Is there not a "best of both worlds" solution? Either way, thanks for the response! |
ts-node is complaining about two specific statements.
Running We could deal with the TS2339 issue by adding I have no solution to the The only other thing I can suggest for now is to have your test run twice. First run without nyc using full ts-node/register, then run with nyc and ts-node/register/transpile-only. |
@coreyfarrell Thanks for digging into this deeper. I will set up my tooling to run the tests twice as you suggest. While not completely solved, it is nice to know the root causes were found. |
@dawsonc623 istanbuljs/istanbuljs#352 will address the error related to setting coverageData.hash. Once that is merged / released it will be possible to use |
@dawsonc623 I was actually able to fix both issues you reported here. |
@coreyfarrell Fantastic news! Thanks for tackling this. |
Link to bug demonstration repository.
https://github.com/dawsonc623/nyc-bug-demo
Expected Behavior
Running
yarn test
should yield passing tests with 100% coverage.Observed Behavior
Running
yarn test
fails with the following errors and reports 0% Statement and Line coverage (Branch and Funcs are at 100% presumably because there are none in the file).There is also a massive stack trace, but it does not seem particularly useful to post the whole thing here.
Forensic Information
Operating System: Ubuntu 18.04.2 LTS on Windows 10 via the Windows Subsystem for Linux
Environment Information: https://gist.github.com/dawsonc623/5d175ea45c6c5fb5359dc11bfeb05df3
The text was updated successfully, but these errors were encountered: