istanbul code coverage shows no coverage for % Lines

28 Views Asked by At

I am implementing code coverage for playwright tests, using Istanbul. I have installed babel plugin (babel-plugin-istanbul) and nyc (https://github.com/istanbuljs/nyc).

I am initially running a single test to see who coverage is captured:

npx nyc playwright test HistoryTMZDownload.spec.ts

my .nycrc file is:

{
  "extends": "@istanbuljs/nyc-config-typescript",
  "all": true,
  "check-coverage": true,
  "include": [
  ],
  "exclude": [
    "playwright.config.ts",
    "**/*.hot-update.js",
    "**/adminFixture.ts",
    "**/baseFixtures.ts",
    "**/userFixture.ts",
    "**/apiFixture.ts"
  ],
  "reporter": ["text", "json-summary", "html"]
}

NOTE: I have specifically removed some of the excludes, but will add them back in later.

When I run the test, I get code coverage (% Lines) only on the test script and associated test setup files. All other files stay at 0%. So code coverage is obviously working to some degree, but how do it get it to pick up coverage on the other files?

enter image description here

0

There are 0 best solutions below