Skip to content

Commit ccc1103

Browse files
cairoethAmxx
andauthored
Add Foundry tests to coverage (#5098)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
1 parent 9af280d commit ccc1103

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ coverage:
1010
project:
1111
default:
1212
threshold: 1%
13+
ignore:
14+
- "test"
15+
- "contracts/mocks"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"compile": "hardhat compile",
1212
"compile:harnesses": "env SRC=./certora/harnesses hardhat compile",
13-
"coverage": "env COVERAGE=true hardhat coverage",
13+
"coverage": "scripts/checks/coverage.sh",
1414
"docs": "npm run prepare-docs && oz-docs",
1515
"docs:watch": "oz-docs watch contracts docs/templates docs/config.js",
1616
"prepare": "git config --local core.hooksPath .githooks",

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)