Last active
September 23, 2019 22:55
-
-
Save collinjackson/b760e6914883440579b72c9ac5d40807 to your computer and use it in GitHub Desktop.
Gets coverage data for Flutter packages
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/bash | |
set -e | |
if [ $# -eq 0 ] | |
then | |
echo Usage: ./coverage.sh package_1 package_2 ... | |
exit 1 | |
fi | |
for package in $@; do | |
echo $package | |
pub cache add $package >/dev/null # Download it if it's not already there | |
version=`pub cache add $package | awk '{print $4}' | sed -e s/[.]*$//` | |
pushd ~/.pub-cache/hosted/pub.dartlang.org/$package-$version/ | |
grep flutter_test pubspec.yaml || (cp pubspec.yaml pubspec.yaml.bak && cat pubspec.yaml.bak | awk '/dev_dependencies/{print;print " flutter_test:";print " sdk: flutter";next}1' > pubspec.yaml) | |
(flutter test --coverage && genhtml coverage/lcov.info -o coverage --no-function-coverage -s -p `pwd` | tail -n 1) | |
(mv pubspec.yaml.bak pubspec.yaml) | |
popd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment