Skip to content

Commit 0a3b295

Browse files
committed
Port coverage script with both hardhat and forge coverage
1 parent a447ded commit 0a3b295

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"compile": "hardhat compile",
1414
"lint": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --check",
1515
"lint:fix": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --write",
16-
"coverage": "hardhat coverage",
16+
"coverage": "scripts/checks/coverage.sh",
1717
"test": "hardhat test"
1818
},
1919
"homepage": "https://openzeppelin.com/contracts/",

scripts/checks/coverage.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
export COVERAGE=true
6+
export FOUNDRY_FUZZ_RUNS=10
7+
8+
# Hardhat coverage
9+
hardhat coverage
10+
11+
if [ "${CI:-"false"}" == "true" ]; then
12+
# Foundry coverage
13+
forge coverage --report lcov
14+
# Remove zero hits
15+
sed -i '/,0/d' lcov.info
16+
fi
17+
18+
# Reports are then uploaded to Codecov automatically by workflow, and merged.

0 commit comments

Comments
 (0)