Created
February 3, 2020 01:05
-
-
Save passsy/e423fe604bcd642dc11e6709c1bb6c89 to your computer and use it in GitHub Desktop.
Run dart code coverage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: ./tool/run_coverage.sh 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/lcov.info \ | |
--packages=.packages \ | |
--report-on lib | |
if type genhtml >/dev/null 2>&1; then | |
genhtml -o out/coverage/html out/coverage/lcov.info | |
echo "open coverage report $PWD/out/coverage/html/index.html" | |
else | |
echo "genhtml not installed, can't generate html coverage output" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment