cypress-io/code-coverage

excludeAfterRemap set to true makes the reports empty

thibleroy opened this issue ยท 4 comments

Logs and screenshots

 code-coverage parsed sent coverage +2s
  code-coverage wrote coverage file C:\Users\thibl\dev\SpotiFine\e2e\.nyc_output\out.json +6ms
  code-coverage NYC file C:\Users\thibl\dev\SpotiFine\e2e\.nyc_output\out.json has 39 key(s) +0ms
  code-coverage 1 key C:\Users\thibl\dev\SpotiFine\front\spotifine\src\zone-flags.ts file path C:\Users\thibl\dev\SpotiFine\front\spotifine\src\zone-flags.ts +1ms
  code-coverage 2 key C:\Users\thibl\dev\SpotiFine\front\spotifine\src\polyfills.ts file path C:\Users\thibl\dev\SpotiFine\front\spotifine\src\polyfills.ts +0ms
  code-coverage 3 key C:\Users\thibl\dev\SpotiFine\front\spotifine\src\environments\environment.ts file path C:\Users\thibl\dev\SpotiFine\front\spotifine\src\environments\environment.ts +0ms
  code-coverage in file C:\Users\thibl\dev\SpotiFine\e2e\.nyc_output\out.json all files are not found? false +3ms
  code-coverage NYC file C:\Users\thibl\dev\SpotiFine\e2e\.nyc_output\out.json has 39 key(s) +3ms
  code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'lcov', 'clover', 'json' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: true } +7ms
  code-coverage calling NYC reporter with options { 'report-dir': 'C:\\Users\\thibl\\dev\\SpotiFine\\e2e\\coverage', reporter: [ 'lcov', 'clover', 'json' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRe
map: true, tempDir: 'C:\\Users\\thibl\\dev\\SpotiFine\\e2e\\.nyc_output', reportDir: 'C:\\Users\\thibl\\dev\\SpotiFine\\e2e\\coverage' } +69ms
  code-coverage current working directory is C:\Users\thibl\dev\SpotiFine\e2e +1ms
  code-coverage after reporting, returning the report folder name C:\Users\thibl\dev\SpotiFine\e2e\coverage +201ms
  code-coverage Final coverage in C:\Users\thibl\dev\SpotiFine\e2e\coverage\coverage-final.json +0ms
  code-coverage There are 0 key(s) in C:\Users\thibl\dev\SpotiFine\e2e\coverage\coverage-final.json +0ms

versions

  • Cypress 4.4.1
  • Angular 9.1.3
  • code-coverage plugin : 3.5.3
  • os : windows 10
  • shell : powershell
  • Node v12.11.1
  • npm v6.11.3
  • application instrumented using istambul
  • window.coverage : yes
  • no custom NYX setting

describe the bug

Nyc reprter doesn't report coverage when excludeAfterRemap is set to true in common-utils.js file (default plugin configuration), when testing an angular 8+ app.

link to the repo
cypress-code-coverage-bug

workaround

Set excludeAfterRemap to true in common-utils.js file.

Great bug report, so nice, I will link it in the github issue template as an example!

workaround

In package.json set the option

{
  "nyc": {
    "excludeAfterRemap": false
  }
}

Let me see if we can do more in this plugin to solve this, problem is, excludeAfterRemap is not documented in NYC itself

Initially, I set excludeAfterRemap: true in examples/exclude-files because in non-interactive mode parcel kept adding coverage for files in the nyc.exclude list. I think it is better to let it be, and explain to the user how to filter files later on.

๐ŸŽ‰ This issue has been resolved in version 3.5.4 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 3.5.4 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Thank you very much for your prompt response
@AirJulien