The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hyperlane-monorepo/solidity/coverage.sh

41 lines
986 B

set -e # exit on error
# generates lcov.info
forge coverage --report lcov
# generates coverage/lcov.info
yarn hardhat coverage
# Foundry uses relative paths but Hardhat uses absolute paths.
# Convert absolute paths to relative paths for consistency.
sed -i -e 's/\/.*solidity.//g' coverage/lcov.info
# Merge lcov files
lcov \
--rc lcov_branch_coverage=1 \
--add-tracefile coverage/lcov.info \
--add-tracefile lcov.info \
--output-file merged-lcov.info
# Filter out node_modules, test, and mock files
lcov \
--rc lcov_branch_coverage=1 \
--remove merged-lcov.info \
--output-file filtered-lcov.info \
"*node_modules*" "*test*" "*mock*"
# Generate summary
lcov \
--rc lcov_branch_coverage=1 \
--list filtered-lcov.info
# Open more granular breakdown in browser
if [ "$CI" != "true" ]
then
genhtml \
--rc genhtml_branch_coverage=1 \
--output-directory coverage \
filtered-lcov.info
open coverage/index.html
fi