Skip to content

Commit

Permalink
coverage script
Browse files Browse the repository at this point in the history
  • Loading branch information
cairoeth committed Jun 27, 2024
1 parent 5c503c1 commit 9dc12c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"compile": "hardhat compile",
"compile:harnesses": "env SRC=./certora/harnesses hardhat compile",
"coverage": "env COVERAGE=true hardhat coverage && FOUNDRY_FUZZ_RUNS=10 forge coverage --report lcov && lcov -o lcov.info --remove lcov.info 'test/*' 'contracts/mocks/*' && awk '!/,0/' lcov.info > temp && mv temp lcov.info",
"coverage": "scripts/checks/coverage.sh",
"docs": "npm run prepare-docs && oz-docs",
"docs:watch": "oz-docs watch contracts docs/templates docs/config.js",
"prepare": "git config --local core.hooksPath .githooks",
Expand Down
16 changes: 16 additions & 0 deletions scripts/checks/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

export COVERAGE=true
export FOUNDRY_FUZZ_RUNS=10

# Hardhat coverage
npx hardhat coverage

# Foundry coverage
forge coverage --report lcov
# Remove test and mock data
lcov --rc derive_function_end_line=0 -o lcov.info --remove lcov.info 'test/*' 'contracts/mocks/*'
# Remove zero hits
awk '!/,0/' lcov.info > temp && mv temp lcov.info

# Reports are then uploaded to Codecov automatically by workflow, and merged.

0 comments on commit 9dc12c9

Please sign in to comment.