Generates lcov and/or HTML coverage reports for Dart projects. (UNIX only)
Dart Code Coverage Generator #
Generate code coverage for Dart projects. Output can be lcov format or an HTML report.
This project includes a
codecov executable that runs one or many test files and uses the
coverage package to collect coverage for each file and format the coverage into the desired output format.
Depends on the following utilities:
- genhtml (
brew install lcovon a mac)
- lsof (standard unix utility)
Add this to your package's pubspec.yaml file:
dependencies: coverage: "^0.7.0" codecov: "^0.4.0"
pub get --packages-dir
pub run codecov
By default, this tool runs every test file in the
test/ directory. You can explicitly specify the directories or files like so:
pub run codecov test/my_test.dart
--report-on: Which directories or files to report coverage on. For example,
--html: Whether or not to generate the HTML report. Defaults to true.
--lcov: Whether or not to generate the .lcov file. Defaults to true.
--verbose: Toggle verbose output to stdout.
The tooling currently relies on the deprecated packages directories generated by pub. If the
.packages file should be used instead, modify the call to
pub run coverage:format_coverage in