c8 icon indicating copy to clipboard operation
c8 copied to clipboard

try reproducing incorrect coverage when loading querystring

Open iambumblehead opened this issue 2 years ago • 2 comments

This PR attempts to reproduce inaccurate coverage results described here https://github.com/bcoe/c8/issues/325 cc @koshic @coderaiser @shnhrrsn

update (success): to reproduce the error with this branch, run npm run test-loader The error is not reproduced when all tests run together, as in npm run test so a separate npm run test-loader command is added to reproduce the issue.

--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   82.14 |       80 |      50 |   82.14 |                   
 vanilla      |     100 |      100 |     100 |     100 |                   
  loaded.js   |     100 |      100 |     100 |     100 |                   
  main.js     |     100 |      100 |     100 |     100 |                   
 vanilla/dir  |       0 |        0 |       0 |       0 |                   
  unloaded.js |       0 |        0 |       0 |       0 | 1-5               
--------------|---------|----------|---------|---------|-------------------

iambumblehead avatar Nov 21 '23 20:11 iambumblehead

for convenience, the vanilla directory at the PR is linked here

c8火$ tree test/fixtures/all/vanilla/
test/fixtures/all/vanilla/
├── dir
│   └── unloaded.js
├── loaded.js
├── main.js
└── main.querystring-import.mjs

2 directories, 4 files

iambumblehead avatar Nov 21 '23 20:11 iambumblehead

Experimenting a little big creates a situation that reproduces the error. At this PR, comment-out all other tests in "./test/integration.js" and the coverage error occurs

--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   82.14 |       75 |      50 |   82.14 |                   
 vanilla      |     100 |      100 |     100 |     100 |                   
  loaded.js   |     100 |      100 |     100 |     100 |                   
  main.js     |     100 |      100 |     100 |     100 |                   
 vanilla/dir  |       0 |        0 |       0 |       0 |                   
  unloaded.js |       0 |        0 |       0 |       0 | 1-5               
--------------|---------|----------|---------|---------|-------------------

iambumblehead avatar Nov 21 '23 20:11 iambumblehead