Skip to content

Coverage report inconsistent #4876

@oraclown

Description

@oraclown

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (e807429 2023-05-04T00:04:41.301525000Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

Description

  • forge coverage report shows seemingly-accurate percentages of tested functions for some contract files, but 0% for one that clearly has functions tested: src/ParachainRegistry.sol. The relevant test file is test/testParachainRegistry.t.sol.
  • To reproduce, run forge coverage for this repo here.
  • Example output that shows the behavior:
>>> forge coverage
[⠆] Compiling...
[⠰] Compiling 30 files with 0.8.3
[⠑] Compiling 28 files with 0.8.17
[⠰] Solc 0.8.17 finished in 2.27s
[⠒] Solc 0.8.3 finished in 4.94s
Compiler run successful
Analysing contracts...
Running tests...
| File                        | % Lines           | % Statements      | % Branches       | % Funcs         |
|-----------------------------|-------------------|-------------------|------------------|-----------------|
| src/Parachain.sol           | 50.00% (44/88)    | 50.00% (64/128)   | 100.00% (0/0)    | 50.00% (12/24)  |
| src/ParachainGovernance.sol | 100.00% (114/114) | 100.00% (121/121) | 88.16% (67/76)   | 100.00% (10/10) |
| src/ParachainRegistry.sol   | 0.00% (0/28)      | 0.00% (0/30)      | 0.00% (0/4)      | 0.00% (0/12)    |
| src/ParachainStaking.sol    | 100.00% (89/89)   | 100.00% (95/95)   | 90.00% (45/50)   | 100.00% (11/11) |
| Total                       | 77.43% (247/319)  | 74.87% (280/374)  | 86.15% (112/130) | 57.89% (33/57)  |

Apologies if this is a duplicate issue, but I didn't see the specific case searching, or here, but maybe related to this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions