Skip to content

Commit

Permalink
Fix solidity coverage (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes authored Apr 20, 2024
1 parent a91677a commit e10735a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions solidity/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# generates lcov.info
forge coverage --report lcov --no-match-test testFork
forge coverage \
--report lcov \
--no-match-test testFork \
--ir-minimum # https://github.com/foundry-rs/foundry/issues/3357

if ! command -v lcov &>/dev/null; then
echo "lcov is not installed. Installing..."
Expand All @@ -10,14 +13,16 @@ fi

lcov --version

# forge does not instrument libraries https://github.com/foundry-rs/foundry/issues/4854
EXCLUDE="*test* *mock* *node_modules* $(grep -r 'library' contracts -l)"
lcov --rc lcov_branch_coverage=1 \
# exclude FastTokenRouter until https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2806
EXCLUDE="*test* *mock* *node_modules* *FastHyp*"
lcov \
--rc lcov_branch_coverage=1 \
--remove lcov.info $EXCLUDE \
--output-file forge-pruned-lcov.info \
--remove lcov.info $EXCLUDE

if [ "$CI" != "true" ]; then
genhtml --rc lcov_branch_coverage=1 \
--output-directory coverage forge-pruned-lcov.info \
&& open coverage/index.html
genhtml forge-pruned-lcov.info \
--rc lcov_branch_coverage=1 \
--output-directory coverage
open coverage/index.html
fi

0 comments on commit e10735a

Please sign in to comment.