Skip to content

Commit bab4940

Browse files
committed
fix: add coverage reporting
1 parent e60f51c commit bab4940

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Enable automatic export of variables
4+
set -o allexport
5+
# Source the .env file
6+
source ./.env
7+
# Disable automatic export of variables
8+
set +o allexport
9+
10+
# Get the latest Base block number and export it
11+
# this is necessary because if we don't pass a specific block number for `forge test`,
12+
# then reads will passthrough to the chain, and cause timestamp issues.
13+
# because we will read stuff from the real chain with state that has the real block.timestamp which can be ahead of the fork
14+
# which can cause overflow/underflow issues when doing things like block.timestamp - lastUpdate, in morpho, for example
15+
# where lastUpdate is the timestamp of the last update to the morpho market
16+
LATEST_BLOCK=$(cast block-number --rpc-url "$BASE_RPC_URL")
17+
echo "Latest Base block number: $LATEST_BLOCK"
18+
19+
# run the tests
20+
forge coverage --ffi -vvv --fork-url "$BASE_RPC_URL" --fork-block-number "$LATEST_BLOCK" --ir-minimum

packages/libs/contracts-sdk/scripts/run_forge_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ LATEST_BLOCK=$(cast block-number --rpc-url "$BASE_RPC_URL")
1717
echo "Latest Base block number: $LATEST_BLOCK"
1818

1919
# run the tests
20-
forge test --ffi -vvv --fork-url "$BASE_RPC_URL" --fork-block-number "$LATEST_BLOCK"
20+
forge test --ffi -vvv --fork-url "$BASE_RPC_URL" --fork-block-number "$LATEST_BLOCK" --coverage

0 commit comments

Comments
 (0)