cenfun / monocart-coverage-reports

A code coverage tool to generate native V8 reports or Istanbul reports.
MIT License
31 stars 5 forks source link

[Help] The `all` option does nothing #36

Closed mrazauskas closed 3 months ago

mrazauskas commented 3 months ago

Really happy to find this library. I was looking for a tool which could process V8 coverage and merge it as well.

At the moment I try to replace v8 with monocart-coverage-reportss programatic API. The migration PR is here: https://github.com/tstyche/tstyche/pull/228

I managed to figure out everything except the all option. In the PR you can see list of filters. "**/main.ts": false is one of the entries, but main.ts file is not excluded, see the report: https://github.com/tstyche/tstyche/actions/runs/9481442960/job/26124230819

If filter is specified as a function, it gets called with all paths which should be there. Feels like dir is set correctly, but filter: () => false has no effect at all. Hm.. What I do wrong?

cenfun commented 3 months ago

@mrazauskas the all option is design for including untested files, so the all.filter should not be able to filter the files from the tested files. please try entryFilter and sourceFilter, for example:

  entryFilter: {
    "**/main.ts": false,
    "**/node_modules/**": false,
    "**/build/**": true,
  },
  sourceFilter: {
    "**/main.ts": false,
    "**/node_modules/**": false,
    "**/source/**": true,
  },
mrazauskas commented 3 months ago

Thanks for quick reply. That’s right! I have to use filters and it all works as expected. Now it is clear for me what the filters do.

This is not related. I was just wondering. reports: "raw" is producing JSON files similar to V8 coverage data. Are they equivalent? Sorry, I didn't dig deep, but you should know that by heart (;

cenfun commented 3 months ago

I was just wondering. reports: "raw" is producing JSON files similar to V8 coverage data. Are they equivalent? Sorry, I didn't dig deep, but you should know that by heart (;

Not equivalent. the raw reports could include raw V8 coverage data and source files and sourcemaps.

mrazauskas commented 3 months ago

Thanks! Got it.