- Install the
coverage
package:pub global activate coverage
- Create a test file for running all of the tests.
- Run — in this case, the file with all of the tests is called
.test_coverage.dart
—:dart --pause-isolates-on-exit --disable-service-auth-codes --enable-vm-service=NNNN test/.test_coverage.dart
- Use the observatory's address to collect coverage:
pub global run coverage:collect_coverage --uri=http://127.0.0.1:63243/ -o coverage.json
- Format the coverage to the
LCOV
format:pub global run coverage:format_coverage --lcov -i coverage.json -o lcov.info
Last active
October 8, 2020 00:00
-
-
Save psygo/7801c4928cf27f89330d138f907ff77b to your computer and use it in GitHub Desktop.
Code Coverage with Pure Dart
The source is here.
echo ""
echo "[RUNNING TEST + COVERAGE]"
pub run test_coverage --no-badge --print-test-output --min-coverage 40
rm coverage_badge.svg
echo ""
echo "[GENERATING COVERAGE REPORT AT ./coverage]"
genhtml ./coverage/lcov.info -o coverage
echo ""
echo "[OPENING ./coverage/index.html]"
open ./coverage/index.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment