'Incorrect code coverage using nyc with Jest Based E2E Test Framework
I am trying to generate code coverage for the single e2e test case. Here is what I did to achieve this.
- Instrumented files related to e2e test case using nyc. Note here I used in place instrumentation
- Executed test cases.
- stored coverage report using window.__coverage__into.nyc_output/coverage.json.
- generated report using nyc report --reporter=lcov --reporter=textcommand. created coverage folder
I can see that its showing branches , lines statements functions of instrumented code. Actually it should show statement , lines of original code.
Here is my nycrc file.
 {
  "extends": "nyc-config-tsx",
  "exclude": [
    "**/*.test.tsx",
    "**/*.mock.tsx",
    "**/*.test.ts",
    "**/*.mock.ts"
  ],
  "extension": [
    ".js",
    ".ts",
    ".jsx",
    ".tsx"
  ],
  "exclude-after-remap": false,
  "all": true,
  "cache": false,
  "source-map": true,
  "produce-source-map": true
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
