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

NYC coverage with "all" option not working for AVA with TypeScript #2507

Closed
rkalis opened this issue Jun 4, 2020 · 4 comments
Closed

NYC coverage with "all" option not working for AVA with TypeScript #2507

rkalis opened this issue Jun 4, 2020 · 4 comments

Comments

@rkalis
Copy link

rkalis commented Jun 4, 2020

I recently ported a JS project that uses AVA to TS. Using @ava/typescript itself worked fine, but I struggled with getting the nyc coverage to work (it was displaying 0% coverage for everything).

In the end this was caused by the fact that I had enabled the "all" option in nyc (Whether or not to instrument all files (not just the ones touched by your test suite). So after disabling this option coverage was working again.

I can publish the relevant code next week if needed.

For now I'm good with running nyc without the "all" option though.

@novemberborn
Copy link
Member

This is a problem with nyc though.

@rkalis
Copy link
Author

rkalis commented Jun 5, 2020

I'm happy to open the issue on their repo, but the reason I opened it here is that I've never had the issue when using that option on nyc with mocha or jest + TypeScript.

@novemberborn
Copy link
Member

nyc applies quite a lot of hacks to record the coverage. @ava/typescript, while not as hacky, still requires JS code from a build directory, rather than the TypeScript code from a source directory. It's all a bit complicated.

I've been switching my projects to use https://github.com/bcoe/c8 which doesn't need all these hacks.

@rkalis
Copy link
Author

rkalis commented Jun 5, 2020

Awesome, thanks for the link, I'll check c8 out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants