Flutterando/flutter-coverage

Add option to exclude files (file patterns) from the calculation

Opened this issue · 1 comments

Hi,

for me it would be nice to have the option to specify files or patterns that will be excluded from the coverage calculation. In my project there are some parts which are very hard to test.

Would be nice if you could implement something :)

Yeah, it would be pretty nice to have an extension property such as flutter-coverage.excludedPatterns, or something like that.

However, there is already an unpleasant method you can rely on to achieve this result, that is, removing those files just after you've built the lcov file. The following is an example in which all generated files that end with ".g.dart" are removed from the coverage count, and then the original lcov.info file is replaced with the updated one:

lcov --remove coverage/lcov.info 'lib/**/*.g.dart' -o coverage/lcov.info
genhtml coverage/lcov.info --output=coverage