istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.55k stars 354 forks source link

Exclude flag no working with exclude-after-remap #1394

Open zakrush opened 3 years ago

zakrush commented 3 years ago

Link to bug demonstration repository

I'm use complited cov.json that was generated by https://gitlab.com/gitlab-org/security-products/analyzers/fuzzers/jsfuzz

In my case I give many cov.json from different jobs of tool above. Every job are working into some docker. Then I merged reports from all dockers into one and tryed to build report into job of new docker with needed envirounment. I use option --exclude-after-remap=false becouse without it I get clear report. The same trouble as here: https://github.com/istanbuljs/nyc/issues/1172

My shell for build report:

nyc merge all_coverages merged-output/coverage.json
nyc report -t merged-output \
--report-dir merged-report \
--reporter=html --exclude-after-remap=false \
--exclude ["coverage/**","packages/*/test{,s}/**",\
"**/*.d.ts","test{,s}/**","test{,-*}.{js,cjs,mjs,ts}",\
"**/*{.,-}test.{js,cjs,mjs,ts}","**/__tests__/**",\
"**/{ava,nyc}.config.{js,cjs,mjs}","**/jest.config.{js,cjs,mjs,ts}",\
"**/{karma,rollup,webpack}.config.js","**/{babel.config,.eslintrc,.mocharc}.{js,cjs}",\
"dist/controllers/ldap/**","dist/controllers/sso/**",\
"dist/helpers/[data-encrypt-helper|license-helper].js",\
"tests/**","node_modules/kerberos/**","node_modules/babel*/**",\
"node_modules/bluebird/**","node_modules/ldap*/**",\
"node_modules/mockery/**","node_modules/tslib/**",\
"node_modules/mkdirp/**","node_modules/uuid/**"]

After it I see "tests/" for example and other custom excluded.

:

Expected Behavior

Can't exclude custom modules from report nyc.

Observed Behavior

Troubleshooting steps

Environment Information

 npx envinfo@latest --preset nyc
npx: установлен 1 в 1.396s

  System:
    OS: Linux 5.10 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 1.44 GB / 7.56 GB
  Binaries:
    Node: 15.8.0 - /usr/bin/node
    npm: 6.14.11 - /usr/bin/npm
  npmPackages:
    ts-node: 8.10.2 => 8.10.2 
    typescript: 3.9.3 => 3.9.3 

paste the output here

 node_modules/wrappy                                         |   27.78 |       40 |      25 |   31.25 |                                                                      
  wrappy.js                                                  |   27.78 |       40 |      25 |   31.25 | 11,14,20-31                                                          
 tests                                                       |   78.22 |    68.84 |    76.6 |   78.22 |                                                                      
  fuzz_pass_complexity.js                                    |   58.46 |    45.83 |   63.64 |   58.46 | 30-136,202,275                                                       
  joi_validate_fuzz.js                                       |    62.5 |        0 |     100 |    62.5 | 10-13                                                                
  test-get-users.js                                          |   60.61 |    31.82 |   61.54 |   60.61 | 30-34,73-133,290                                                     
  test-login-logout.js                                       |    96.1 |    92.73 |     100 |    96.1 | 62,120,288                                                           
  test-passwords.js                                          |   91.95 |    92.42 |   81.82 |   91.95 | 30-34,61,92,181,290                
lunchboxdc commented 2 years ago

I'm encountering the same problem, has anyone had a chance to look into this? I'm not even trying to exclude anything from my report.

I ran a cypress test with @cypress/code-coverage instrumentation which generated a .nyc_output/out.json file and attempted to generate the report with npx nyc report --reporter=text-summary and the output was empty. I have no other nyc configuration present.

If I add on the --exclude-after-remap=false, the summary shows actual results.

clazette commented 2 years ago

Any resolution to this issue?