-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (94 loc) · 3.69 KB
/
Copy pathMakefile
File metadata and controls
109 lines (94 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# GhostFund — Test Runner
# Usage: make [target] (default: test)
-include .env
export
# Pinned Sepolia block where Aave USDC pool has capacity
FORK_BLOCK ?= 7500000
.PHONY: check install test test-sol test-fuzz test-invariant test-security test-fork test-ts test-all coverage gas
# Default target
test: check test-sol test-fuzz test-invariant test-security test-ts
@echo ""
@echo "=========================================="
@echo " All local tests complete"
@echo "=========================================="
check:
@echo "=========================================="
@echo " Checking prerequisites"
@echo "=========================================="
@command -v forge >/dev/null 2>&1 || { echo "ERROR: forge not found. Install: https://book.getfoundry.sh"; exit 1; }
@command -v bun >/dev/null 2>&1 || { echo "ERROR: bun not found. Install: https://bun.sh"; exit 1; }
@test -f .env || { echo "ERROR: .env not found at project root"; exit 1; }
@echo " forge: $$(forge --version | head -1)"
@echo " bun: $$(bun --version)"
@echo " .env: found"
@echo ""
install:
@echo "=========================================="
@echo " Installing dependencies"
@echo "=========================================="
cd contracts && forge install
cd scripts && bun install
@echo ""
test-sol:
@echo "=========================================="
@echo " Solidity unit tests (47)"
@echo "=========================================="
cd contracts && forge test --match-path test/GhostFundVault.t.sol -vv
@echo ""
test-fuzz:
@echo "=========================================="
@echo " Fuzz tests (8 × 1000 runs)"
@echo "=========================================="
cd contracts && forge test --match-path test/GhostFundVault.fuzz.t.sol -vv
@echo ""
test-invariant:
@echo "=========================================="
@echo " Invariant tests (3 × 256 runs)"
@echo "=========================================="
cd contracts && forge test --match-path test/GhostFundVault.invariant.t.sol -vv
@echo ""
test-security:
@echo "=========================================="
@echo " Security tests (5)"
@echo "=========================================="
cd contracts && forge test --match-path test/GhostFundVault.security.t.sol -vv
@echo ""
test-fork:
@echo "=========================================="
@echo " Fork tests — Sepolia Aave V3 (6)"
@echo "=========================================="
@if [ -z "$(SEPOLIA_RPC_URL)" ]; then \
echo " SKIPPED: SEPOLIA_RPC_URL not set in .env"; \
echo ""; \
else \
cd contracts && forge test --match-path test/GhostFundVault.fork.t.sol --fork-url $(SEPOLIA_RPC_URL) --fork-block-number $(FORK_BLOCK) -vv; \
echo ""; \
fi
test-ts:
@echo "=========================================="
@echo " TypeScript tests (46)"
@echo "=========================================="
cd scripts && bun run test
@echo ""
test-all: check test-sol test-fuzz test-invariant test-security test-fork test-ts
@echo ""
@echo "=========================================="
@echo " All tests complete (including fork)"
@echo "=========================================="
coverage:
@echo "=========================================="
@echo " Solidity coverage"
@echo "=========================================="
cd contracts && forge coverage --no-match-path test/GhostFundVault.fork.t.sol
@echo ""
@echo "=========================================="
@echo " TypeScript coverage"
@echo "=========================================="
cd scripts && bun run test:coverage
@echo ""
gas:
@echo "=========================================="
@echo " Gas report"
@echo "=========================================="
cd contracts && forge test --gas-report --no-match-path test/GhostFundVault.fork.t.sol
@echo ""