diff options
Diffstat (limited to 'platform/ios/scripts/code-coverage.sh')
-rw-r--r-- | platform/ios/scripts/code-coverage.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/platform/ios/scripts/code-coverage.sh b/platform/ios/scripts/code-coverage.sh new file mode 100644 index 0000000000..27a8a06e59 --- /dev/null +++ b/platform/ios/scripts/code-coverage.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# Get code coverage, then convert it to JSON. +cov_result=build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport +xcrun xccov view $cov_result --json > output.json + +# Access the overall line coverage for the dynamic build. +percentage=`node -e "console.log(require('./output.json').lineCoverage)"` + +# Convert the coverage from "0.x" format to a percentage. +cov=$(printf "%.2f" $(echo "$percentage*100" | bc -l)) +echo $cov + +# Clean up files. +rm -rf build/ios/ios/Logs/Test/*.xcresult/ +rm -f output.json
\ No newline at end of file |