Skip to content

Commit

Permalink
Merge pull request #323 from aave/feat/320-unified-coverage-gen
Browse files Browse the repository at this point in the history
feat: add combined coverage from hardhat/foundry
  • Loading branch information
cedephrase authored May 4, 2023
2 parents dc8b27a + 00e2550 commit 524fb1b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
.DS_Store
forge-cache
/report
lcov.info
lcov.info
combined-lcov.info
33 changes: 33 additions & 0 deletions combined-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

#!/bin/bash

# @dev
# This bash script creates coverage reports via Hardhat and Foundry
# and then merges them, removing uninteresting files

export NODE_OPTIONS="--max_old_space_size=8192"

set -e

npm run hardhat coverage
forge coverage --report lcov

sed -i -e 's/\/.*gho-core.//g' coverage/lcov.info

lcov \
--rc lcov_branch_coverage=1 \
--add-tracefile coverage/lcov.info \
--add-tracefile lcov.info \
--output-file merged-lcov.info

lcov \
--rc lcov_branch_coverage=1 \
--remove merged-lcov.info \
--output-file combined-lcov.info \
"*node_modules*" "*test*" "*mock*"

rm merged-lcov.info

lcov \
--rc lcov_branch_coverage=1 \
--list combined-lcov.info
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"test:stkAave": ". ./setup-test-env.sh && hardhat test ./src/test/__setup.test.ts ./src/test/stkAave-upgrade.test.ts",
"test-unit": ". ./setup-test-env.sh && hardhat test ./src/test/unitTests/*.ts",
"coverage": ". ./setup-test-env.sh && hardhat coverage",
"combined-coverage": ". ./setup-test-env.sh && ./combined-coverage.sh",
"deploy-testnet": ". ./setup-test-env.sh && hardhat deploy-and-setup",
"deploy-testnet:goerli": "HARDHAT_NETWORK=goerli npm run deploy-testnet",
"deploy-testnet:goerli:fork": "FORK=goerli npm run deploy-testnet",
Expand Down

0 comments on commit 524fb1b

Please sign in to comment.