foundry icon indicating copy to clipboard operation
foundry copied to clipboard

forge coverage for libraries is not updating

Open snreynolds opened this issue 2 years ago • 2 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (a5efe4f 2024-02-08T00:16:00.244105000Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

I am writing unit tests for some libraries and am getting 0% coverage with forge coverage. Feel free to look at this branch as an example! https://github.com/Uniswap/relayer/pull/57

snreynolds avatar Feb 08 '24 23:02 snreynolds

I believe this is a duplicate of https://github.com/foundry-rs/foundry/issues/2567

EDIT: the PR that is referenced in the issue says:

This does not currently handle cases where using for is used for internal libraries since it seems like we lose information on what libraries were bound to what types..

A potential workaround is calling the library explicitly e.g. MyLib.helper(MyType) instead of using MyLib for MyType

0xalpharush avatar Feb 09 '24 01:02 0xalpharush

@0xalpharush

I moved to using the library explicitly and I'm still not seeing updates in forge coverage. See commits here https://github.com/Uniswap/relayer/pull/57

snreynolds avatar Feb 09 '24 15:02 snreynolds

@0xalpharush I'm having a similar issue. I've tried calling my library functions explicitly and still don't see the coverage being updated. Are there other workarounds to this?

superical avatar Mar 01 '24 14:03 superical