sc-forks / solidity-coverage

Code coverage for Solidity smart-contracts
MIT License
975 stars 263 forks source link

Add extendConfig logic for hardhat-viem plugin #883

Closed cgewecke closed 6 months ago

cgewecke commented 6 months ago

874, #819

PR adds logic to support the hardhat-viem plugin. If you run the env variable set as below it will configure the hardhat network correctly in the extendConfig hook and skip provider redefinition at the task level.

SOLIDITY_COVERAGE=true npx hardhat coverage

This approach is necessary because there's no way to know from within extendConfig whether the coverage task is actually being run and therefore no safe way to redefine the network settings.

If viem is defined in the hardhat environment and the network has not been set with the correct defaults, an error is thrown:

Screen Shot 2024-04-05 at 1 41 43 PM

codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.61%. Comparing base (011ee40) to head (ac4a0b3).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #883 +/- ## ========================================== + Coverage 96.45% 96.61% +0.15% ========================================== Files 19 19 Lines 1045 1062 +17 ========================================== + Hits 1008 1026 +18 + Misses 37 36 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.