test-coverage
test-coverage copied to clipboard
Exclude files
Hi!
I'm using this pub run test_coverage --exclude="**.g.dart" to exclude generated file. Seem that it doesn't work.
Any idea?
exclude option is only for excluding some files inside test folder, e.g. if you have any fixtures there.
Looks like you are trying to exclude some source files, which is not possible at this point.
There's a library that currently handles this: jack-r-warren/remove_from_coverage. Any chance of merging that functionality here?
How could i ignore .g.dart files while running pub run test_coverage ?
awaiting for solution
The underlying coverage package should ignore source code when you use special comments described here (see the end of the page). I am trying to use them, but for some reason they don't work. Is it an issue with coverage or is it test_coverage?
Okay, I found some PRs about this:
- https://github.com/flutter/flutter/pull/61408
- https://github.com/dart-lang/coverage/pull/246
It seems it's either implemented, but does not work for me for some reason, or still being worked on. I don't quite get it, can anyone help?
If I got it right, they implemented the feature, but this package is not up to date with the changes. Does anyone plan to update test_coverage?
I can update dependencies to the latest. Though whichever package generated your *.g.dart files also needs to be updated to include those new comment blocks, right? Is this addressed already as well?
Oh well, there are workarounds to excluding generated files, or maybe even convenient ways to do it. I just want to use these comments in some of my files, where I declared Moor tables. Then *.g.dart files are generated from these declarations, but they are not referenced anywhere else in code, which leads to them not being included in coverage. I would like to see realistic coverage that I have control over. Would appreciate if you update dependencies :smile_cat: