foundry: forge coverage: "No such file or directory (os error 2)"

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 (0d44687 2022-07-01T00:27:19.177599Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Intel)

Describe the bug

forge coverage results in this error saying a file isn’t found, but I’ve confirmed it exists at that location. 🤔

❯ forge coverage
[⠒] Compiling...
[⠢] Compiling 4 files with 0.8.7
[⠆] Compiling 69 files with 0.8.14
[⠰] Compiling 1 files with 0.8.4
[⠒] Solc 0.8.4 finished in 16.49ms
[⠰] Solc 0.8.7 finished in 2.23s
[⠃] Solc 0.8.14 finished in 10.15s
Compiler run successful
Analysing contracts...
Error: 
failed to read from "node_modules/.pnpm/@openzeppelin+contracts-upgradeable@4.4.2/node_modules/@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": No such file or directory (os error 2)

Context:
- No such file or directory (os error 2)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

I am now able to run forge coverage on the same project so we might close this if @gigamesh agrees.

I am now able to run forge coverage on the same project so we might close this if @gigamesh agrees.

How have you fixed this issue @gigamesh ? Experiencing the same… cc @elenadimitrova @onbjerg

forge 0.2.0 doesn’t say much, I need the commit hash after the version number as well. All nightlies after early this year use 0.2.0 as their version number

Please open up a new issue with some steps I can take to reproduce, I don’t really know where to start looking in that repository’s structure. From what I can tell in your justfile forge coverage is never invoked (DAPP_COVERAGE is not a thing in Forge)

Hi @gigamesh, as mentioned elsewhere coverage is not stable (and is not released as such), so it will take a while for me to turn around on this as there are other bugs that are a bit more pressing re: coverage. I’m currently doing a big change to coverage, so maybe it will “fix itself” after that.

I’m unsure why it can’t read that path specifically, I haven’t spend a lot of time debugging it yet, so I don’t have a very in-depth response for you right now, apologies