c8 icon indicating copy to clipboard operation
c8 copied to clipboard

If excludeAfterRemap is enabled, the coverage stats become constant 100

Open prantlf opened this issue 2 years ago • 0 comments

Environment

  • Version: Node.js v18.14.2
  • Platform: OSX 13.2.1 (Darwin macik.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64)

Report Example

With no source file excluded:

❯ npx c8 report
-------------------------------------------------|---------|----------|---------|---------|-------------------
File                                             | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------------------------------------|---------|----------|---------|---------|-------------------
All files                                        |   90.74 |    67.85 |   47.46 |   90.74 |
 [email protected]/node_modules/@hpcc-js/wasm/dist |     100 |    59.16 |   40.68 |     100 |
  graphviz.js                                    |     100 |    59.16 |   40.68 |     100 | 1
 src                                             |    98.4 |      100 |     100 |    98.4 |
  bundled-engine.js                              |     100 |      100 |     100 |     100 |
  graph.js                                       |     100 |      100 |     100 |     100 |
  renderer.js                                    |     100 |      100 |     100 |     100 |
  script-editor.js                               |   96.84 |      100 |     100 |   96.84 | 71-76
  separate-engine.js                             |     100 |      100 |     100 |     100 |
 src/codejar                                     |     100 |       70 |      30 |     100 |
  codejar.js                                     |     100 |       70 |      30 |     100 | 4-17
 src/prism                                       |   83.56 |    78.72 |   59.25 |   83.56 |
  prism-core.js                                  |   78.75 |    73.13 |   68.42 |   78.75 | ...48-252,322-325
  prism-graphviz.js                              |     100 |      100 |     100 |     100 |
  prism-line-numbers.js                          |   98.19 |    86.66 |      75 |   98.19 | 147-149
  prism-match-braces.js                          |   82.58 |      100 |       0 |   82.58 | ...53,57-61,65-75
-------------------------------------------------|---------|----------|---------|---------|-------------------
ERROR: Coverage for lines (90.74%) does not meet global threshold (100%)
ERROR: Coverage for functions (47.46%) does not meet global threshold (100%)
ERROR: Coverage for branches (67.85%) does not meet global threshold (100%)
ERROR: Coverage for statements (90.74%) does not meet global threshold (100%)

With src/codejar and src/prism excluded:

❯ npx c8 report -a
--------------------|---------|----------|---------|---------|-------------------
File                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------|---------|----------|---------|---------|-------------------
All files           |     100 |      100 |     100 |     100 |
 bundled-engine.js  |     100 |      100 |     100 |     100 |
 graph.js           |     100 |      100 |     100 |     100 |
 renderer.js        |     100 |      100 |     100 |     100 |
 script-editor.js   |     100 |      100 |     100 |     100 |
 separate-engine.js |     100 |      100 |     100 |     100 |
--------------------|---------|----------|---------|---------|-------------------

Note the coverage of script-editor.js jumping from 96.84 to 100.

Test Project

The repository https://github.com/prantlf/c8-ethernal-100 contains test coverage data and instructions how to reproduce the problem. The branch c8-ethernal-100-coverage of the original project (https://github.com/prantlf/graphviz-webcomponent/tree/c8-ethernal-100-coverage) can be use to run the test including the computation of the code coverage.

prantlf avatar Apr 02 '23 10:04 prantlf