Skip to content
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

c8 incorrectly reports 100% coverage when using tsx #558

Closed
6 tasks done
nwalters512 opened this issue May 16, 2024 · 2 comments
Closed
6 tasks done

c8 incorrectly reports 100% coverage when using tsx #558

nwalters512 opened this issue May 16, 2024 · 2 comments
Labels
bug Something isn't working outdated pending triage

Comments

@nwalters512
Copy link
Contributor

nwalters512 commented May 16, 2024

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I am reporting a confirmed bug (not seek debugging help)
  • I understand this is a collaborative project and relies on my contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/nwalters512/tsx-c8-coverage-repro

Problem & expected behavior (under 200 words)

I would expect c8's coverage reports to show something less than 100%, given that my "tests" in src/index.test.ts don't execute the subtract function from index.ts. However, they still report 100% coverage, and don't capture the fact that the code has multiple lines (this is the coverage shown by coverage/index.ts.html after running npm test in the reproduction):

Screenshot 2024-05-16 at 14 43 09

I acknowledge that this issue is very similar to #433. However, it still reproduces on the latest version of tsx, so I felt it best to open a new issue. I based my reproduction on the one from that issue, but stripped it down to be as minimal as possible.

This is reproducible on Node 18, Node 20, and Node 22 (I tried all via nvm use ...).

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • I'm willing to offer financial support
@nwalters512 nwalters512 added bug Something isn't working pending triage labels May 16, 2024
@nwalters512
Copy link
Contributor Author

nwalters512 commented May 16, 2024

I might have opened this prematurely, sorry! I saw https://github.com/pvtnbr/tsx/pull/16 in the development repo, and the bot comment said it was available in 4.9.4-rc.1, so I assumed that the latest version (4.10.3) would contain those changes since it was after 4.9.4-rc.1. However, looking at the relevant line on master, it seems like this changes haven't made it back to this repo yet:

sourcesContent: false,

@privatenumber let me know if I just have to wait for this change to trickle down into an official build!

@privatenumber
Copy link
Owner

Just released it for ya in https://github.com/privatenumber/tsx/releases/tag/v4.10.4

I appreciate the sponsorship! Thanks @nwalters512

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working outdated pending triage
Projects
None yet
Development

No branches or pull requests

2 participants