Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/defuncart/dart_code_coverage
A package with helpers for generating and editing code coverage reports in dart.
https://github.com/defuncart/dart_code_coverage
code-coverage dart flutter lcov lcov-report
Last synced: 7 days ago
JSON representation
A package with helpers for generating and editing code coverage reports in dart.
- Host: GitHub
- URL: https://github.com/defuncart/dart_code_coverage
- Owner: defuncart
- License: mit
- Created: 2020-06-18T15:59:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-29T11:59:50.000Z (almost 3 years ago)
- Last Synced: 2023-03-01T13:52:23.427Z (over 1 year ago)
- Topics: code-coverage, dart, flutter, lcov, lcov-report
- Language: Dart
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dart_code_coverage
A package with helpers for generating and editing code coverage reports in dart.
Inspired by [remove_from_coverage](https://pub.dev/packages/remove_from_coverage) and [dart_coverage_helper](https://stackoverflow.com/questions/54602840/how-can-i-generate-test-coverage-of-untested-files-on-my-flutter-tests).
## Getting Started
### generate_dart_file
Generates a dart file of all project files which should be covered by unit tests.
| option | abbreviation | info |
|--------|--------------|---------------------------------------------------------------------------|
| output | -o | A path to save output file. Defaults to `test/coverage_report_test.dart`. |
| remove | -r | A regexp pattern of paths to exclude. Optional. |
| help | -h | Displays help. |```sh
flutter pub run dart_code_coverage:generate_dart_file -r ".*\.g\.dart","localizations.dart"
```### edit_lcov
Removes files with given patterns from lcov.info
| option | abbreviation | info |
|--------|--------------|---------------------------------------------------------------|
| file | -f | The lcov.info file to edit. Defaults to `coverage/lcov.info`. |
| remove | -r | A regexp pattern of paths to exclude. Must be given. |
| help | -h | Displays help. |```sh
flutter pub run dart_code_coverage:edit_lcov -r ".*\.g\.dart","localizations.dart"
```## Example
```sh
# generate dart file of all files to be covered by unit tests
flutter pub run dart_code_coverage:generate_dart_file -r ".*\.g\.dart","localizations.dart"# generate lcov
flutter test --coverage# edit lcov
flutter pub run dart_code_coverage:edit_lcov -r ".*\.g\.dart","localizations.dart"# generate report
genhtml coverage/lcov.info -o coverage/html
```