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

Default exclude-after-remap in nyc@14 loses coverage information in typescript project #1089

Closed
2 tasks done
acchou opened this issue Apr 25, 2019 · 4 comments
Closed
2 tasks done

Comments

@acchou
Copy link

acchou commented Apr 25, 2019

Link to bug demonstration repository

https://github.com/acchou/nyc-bug

This is a TypeScript project that demonstrates the issue. Instructions for reproducing are in the README.md.

Expected Behavior

Coverage information should be output when exclude-after-remap is true, because "exclude" is empty ([]) and no "include" is specified.

Observed Behavior

No coverage information is reported unless exclude-after-remap is set to false.

When upgrading from nyc@13 to nyc@14, the switch to exclude-after-remap to default true causes this issue to happen by default.

Troubleshooting steps

  • Changing the value of the exclude option had no effect, even if it was made empty.
  • Setting exclude-after-remap to false in package.json made coverage information come back in nyc@14.

Environment Information

  System:
    OS: macOS Mojave 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
    Memory: 527.37 MB / 16.00 GB
  Binaries:
    Node: 11.12.0 - ~/n/bin/node
    npm: 6.7.0 - ~/n/bin/npm
  npmPackages:
    nyc: ^14.0.0 => 14.0.0 
    typescript: 3.4.5 => 3.4.5 

I understand that exclude-after-remap has been made default true in nyc@14. Upgrading broke coverage data collection for my TypeScript project; it was previously working fine in nyc@13.

I attempted to change the value of the exclude setting but it had no effect, even setting it to empty. Only setting exclude-after-remap to false fixes the issue, and it is not obvious why that's necessary in this sort of project.

@coreyfarrell
Copy link
Member

Can you please try adding "extension": [".ts"] to your nyc config? Setting "exclude": [] should be unnecessary (and I don't recommend using it).

@acchou
Copy link
Author

acchou commented Apr 26, 2019

Yes, that resolves the problem. Maybe that warrants changing the default, or some explicit documentation?

@coreyfarrell
Copy link
Member

We're planning to add .ts to the default extension setting for nyc@15. Unfortunately this is a potentially breaking change so it cannot happen in nyc@14. You can follow #1103 for progress on this.

@JaKXz
Copy link
Member

JaKXz commented May 7, 2019

@acchou you can also try the configured preset for TypeScript

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

No branches or pull requests

3 participants