Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Run dart code coverage
# Usage: ./tool/ test/all_tests.dart
(pub global list | grep coverage) || {
# install coverage when not found
pub global activate coverage
pub global run coverage:collect_coverage \
--port=8111 \
--out=out/coverage/coverage.json \
--wait-paused \
--resume-isolates \
dart \
--disable-service-auth-codes \
--enable-vm-service=8111 \
--pause-isolates-on-exit \
--enable-asserts \
pub global run coverage:format_coverage \
--lcov \
--in=out/coverage/coverage.json \
--out=out/coverage/ \
--packages=.packages \
--report-on lib
if type genhtml >/dev/null 2>&1; then
genhtml -o out/coverage/html out/coverage/
echo "open coverage report $PWD/out/coverage/html/index.html"
echo "genhtml not installed, can't generate html coverage output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment