Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"@nomicfoundation/hardhat-foundry" breaks coverage tests. #3961

Closed
LucasGrasso opened this issue May 29, 2023 · 13 comments
Closed

"@nomicfoundation/hardhat-foundry" breaks coverage tests. #3961

LucasGrasso opened this issue May 29, 2023 · 13 comments
Assignees
Labels
area:hardhat-foundry status:ready This issue is ready to be worked on type:bug Something isn't working

Comments

@LucasGrasso
Copy link

Version of Hardhat

2.14.0

What happened?

I Don't know if this is a solidity-coverage or a hardhat-foundry issue, but after importing the latter, it just seems to break coverage tests.
With hardhat-foundry imported;
image
Without hardhat-foundry imported:
image

Tests in Foundry and in Hardhat were made for DecentBatchDepositor.sol. Sorry for the lack of a profound explanation, I just discovered it randomly and seems like a incompatibility bug. Thanks for your help.

Minimal reproduction steps

  • Install and import "@nomicfoundation/hardhat-foundry" in hardhat.config.ts
  • Run coverage tests with npx hardhat coverage
  • Unimport "@nomicfoundation/hardhat-foundry" in hardhat.config.ts
  • Run coverage tests once again with npx hardhat coverage

Search terms

foundry, coverage

@fvictorio
Copy link
Member

Hey @LucasGrasso, sorry for not responding sooner.

I can't reproduce this, at least in the simple Hardhat sample project.

Can you try again with the latest versions of the plugins and see if it's still happening?

And if it's still happening, could you create and share a minimal reproducible example?

@fvictorio fvictorio added status:needs-more-info There's not enough information to start working on this issue and removed status:triaging labels Jun 28, 2023
@LucasGrasso
Copy link
Author

Hello @fvictorio , don't worry. As soon as I get some spare time I'll get to it.

@tariqkb
Copy link

tariqkb commented Jul 14, 2023

@fvictorio I am able to reproduce this issue with the following minimal steps

  1. hardhat init
  2. npm install @nomicfoundation/hardhat-foundry
  3. Add require("@nomicfoundation/hardhat-foundry") to hardhat.config.js
  4. hardhat init-foundry (coverage will work until after this step)
  5. hardhat coverage

Produces this report:
image

@fvictorio
Copy link
Member

Thanks @tariqkb, you are right. I think I forgot to run hh init-foundry when I tried to reproduce this 🤦‍♂️

@fvictorio fvictorio added type:bug Something isn't working status:ready This issue is ready to be worked on area:hardhat-foundry and removed status:needs-more-info There's not enough information to start working on this issue labels Jul 17, 2023
@gatekeeper-app
Copy link

Hi, I am getting the same issue, just wondering if there was any update. Thanks

@bingen
Copy link

bingen commented Feb 20, 2024

I’m getting the same error. It seems that the problem is foundry.toml file. If I remove it, it works again.

@kanej kanej self-assigned this Feb 20, 2024
@miguelmtzinf
Copy link

Same issue here

@partylikeits1983
Copy link

Hello all, I had this same exact issue. Removing the foundry.toml file in the base of the repository fixed this issue. Code coverage is no longer 0%

@cgewecke
Copy link
Contributor

This should be fixed now in the latest solidity-coverage release:
https://github.com/sc-forks/solidity-coverage/releases/tag/v0.8.8

Make sure you run the clean task after you update:

npm install --save-dev solidity-coverage@latest
npx hardhat clean

If there are further problems after installing the patch please report to solidity-coverage issue 853

@miguelmtzinf
Copy link

works on my end! @cgewecke goat 🥇

@bingen
Copy link

bingen commented Feb 22, 2024

It works for me too, thanks!
I’m now having problems with skipping contracts. I think this was working before, so may it be related?

@cgewecke
Copy link
Contributor

@bingen Yes that sounds like it might be related - have opened a ticket about this in the coverage repo at the link above and will take a look later today.

@kanej
Copy link
Member

kanej commented Apr 3, 2024

I am going to close this, thanks @cgewecke

@kanej kanej closed this as completed Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:hardhat-foundry status:ready This issue is ready to be worked on type:bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

9 participants