forge-coverage-test
forge-coverage-test copied to clipboard
Add 2 contracts in different files
The full issue is described here.
Try to test both from different files makes the coverage to report 50% when 100% is expected.
In Contract.t.sol
I am importing import { BranchesNew2 } from "src/Contract1.sol";
In Contract1.t.sol
I am importing import { BranchesNew } from "src/Contract1.sol";
| File | % Lines | % Statements | % Branches | % Funcs |
|-------------------|----------------|----------------|----------------|----------------|
| src/Contract.sol | 76.19% (48/63) | 70.00% (42/60) | 68.75% (33/48) | 85.71% (18/21) |
| src/Contract1.sol | 50.00% (2/4) | 50.00% (2/4) | 50.00% (2/4) | 50.00% (1/2) |
| src/Contract2.sol | 50.00% (1/2) | 50.00% (1/2) | 100.00% (0/0) | 50.00% (1/2) |
| Total | 73.91% (51/69) | 68.18% (45/66) | 67.31% (35/52) | 80.00% (20/25) |