very_good_test_runner icon indicating copy to clipboard operation
very_good_test_runner copied to clipboard

fix: exclude specific folders from coverage

Open stact opened this issue 1 year ago • 2 comments

Description Hi team, we are not able exclude folders from coverage, I don't know if it's a bug, or For instance we have generated folder that include our localization

`very_good test --coverage --exclude-coverage "lib/l10n/**"``

Steps To Reproduce

  1. On your project folder create dummy folder with some dart files
  2. Open a terminal
  3. "cd" to your flutter project folder
  4. Launch the coverage very_good test --coverage --exclude-coverage "lib/l10n/**"
  5. See the results of the coverage (using vscode flutter coverage extension)

Expected Behavior The folder excluded must be ignored for coverage

Screenshots image

Additional Context Tried also to ignore files directly it's not working too

stact avatar Jun 12 '24 06:06 stact

Hi @stact 👋 thanks for opening this issue. From a quick glance at this we were able to reproduce this so were going to look into the --exclude-coverage flag and it's implementation.

We are always willing to let contributors help with fixes as well. Would you be willing to help with this?

tomarra avatar Aug 27 '24 14:08 tomarra

Hi @tomarra thank you for reaching out Unfortunately my knowledge is limited regarding coverage. I was looking in the past some alternative, maybe this PR can help to adapt the vg test https://github.com/dart-lang/coverage/pull/496

stact avatar Aug 27 '24 15:08 stact

Ok it seems something is wrong with very_good test --coverage firstly generated

This solution solved my issue https://github.com/VeryGoodOpenSource/very_good_cli/issues/496#issuecomment-1303258449

lcov --remove coverage/lcov.info '**/generated/**' -o coverage/lcov.info

No problem also on ci.

build:
    uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
    with:
      flutter_channel: stable
      coverage_excludes: "**/generated/**" 

Thank you for your followup @tomarra maybe it can be removed from the backlog

stact avatar Oct 30 '24 21:10 stact