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

Why is nyc coverage with typescript (using mocha) returning zero coverage #1520

Open
yinonby opened this issue May 21, 2023 · 2 comments
Open

Comments

@yinonby
Copy link

yinonby commented May 21, 2023

Link to bug demonstration repository

https://codesandbox.io/p/sandbox/xenodochial-babbage-jrwj0b

Expected Behavior

npm run coverage

I expect 100% coverage

Observed Behavior

npm run coverage

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================

Troubleshooting steps

  • Tried the following .nycrc config, and some subsets of it, following some other posts, nothing works:
"exclude-after-remap": false,
"exclude": [
    "*.test.*",
    "**/*.d.ts"
],
"extension": [
    ".js",
    ".jsx",
    ".ts",
    ".tsx"
],
"check-coverage": true,
"cache": false,
"all": false,
"source-map": true,
"produce-source-map": true,

Environment Information

# paste the output here
  Binaries:
    Node: 16.17.0 - F:\programs\nodejs\node.EXE
    npm: 8.15.0 - F:\programs\nodejs\npm.CMD
  npmPackages:
    nyc: ^15.1.0 => 15.1.0
    source-map-support: ^0.5.21 => 0.5.21
    ts-node: ^10.9.1 => 10.9.1
    typescript: ^5.0.4 => 5.0.4
@kalpeshhpatel
Copy link

@yinonby were you able to root cause the issue?

@PhilHannent
Copy link

I was watching this issue because I had the same problem. Switching to the c8 library solved the problem for me. My project was an ESM modules project, which seems to have teething problems in some projects.

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