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

Uncovered files don't show up in report or decrease overall coverage #1213

Closed
1 task done
beyerleinf opened this issue Oct 23, 2019 · 6 comments
Closed
1 task done

Comments

@beyerleinf
Copy link

Link to bug demonstration repository

nyc-typescript-coverage-issue

Expected Behavior

Files that don't have any coverage at all (i.e. no test file) should show up in the report and add to total blocks etc. - thus decreasing overall coverage for a project.

Observed Behavior

Files without tests don't get included in coverage reports even though all is set to true in .nycrc.json

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config

Environment Information

  System:
    OS: Linux 4.9 LMDE 3 (cindy) 3 (cindy)
    CPU: (6) x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 687.27 MB / 15.66 GB
  Binaries:
    Node: 12.3.1 - ~/.nvm/versions/node/v12.3.1/bin/node
    npm: 6.11.3 - ~/.nvm/versions/node/v12.3.1/bin/npm
  npmPackages:
    nyc: ^14.1.1 => 14.1.1 
    source-map-support: ^0.5.13 => 0.5.13 
    ts-node: ^8.4.1 => 8.4.1 
    typescript: ^3.6.4 => 3.6.4 

@coreyfarrell
Copy link
Member

For nyc 14 you need to add "extension": [".ts"] to your .nycrc.json.

@beyerleinf
Copy link
Author

That's why my .nycrc.json uses @istanbuljs/nyc-config-typescript. It's already set there (see Line 4 of index.json at nyc-config-typescript)

@coreyfarrell
Copy link
Member

Hmmm good point sorry I missed that. Could you try adding parser-plugins to your .nycrc.json? Specifically please set: "parser-plugins": ["typescript"]. If that doesn't work please try:

  "parser-plugins": [
    "typescript",
    "asyncGenerators",
    "bigInt",
    "classProperties",
    "classPrivateProperties",
    "dynamicImport",
    "importMeta",
    "objectRestSpread",
    "optionalCatchBinding"
  ]

I suspect the issue is that your src directory contains typescript syntax which is not transpiled during the --all stage, so istanbul-lib-instrument encounters syntax which it cannot parse.

@beyerleinf
Copy link
Author

beyerleinf commented Oct 27, 2019

"parser-plugins": ["typescript"] did the trick. But I think adding the others won't hurt. I just noticed that I now encounter the race condition from #1113 but I suspect there is no way around that, is there?

@coreyfarrell
Copy link
Member

nyc 15.0.0-beta.0 should fix the race condition from #1113. There is no solution to that issue for nyc 14.

@beyerleinf
Copy link
Author

Okay, thank you. Good to know! :)

@beyerleinf beyerleinf changed the title Uncoverd files don't show up in report or decrease overall coverage Uncovered files don't show up in report or decrease overall coverage Feb 7, 2020
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

2 participants