Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Zer0dot
    @Zer0dot
    Hey guys!
    Quick question, I'm running solidity coverage with hardhat. When I execute an rpc call to hardhat to reset my fork, it pretty much invalidates my coverage.
    Is there a way to reset forks in between test files without losing coverage?
    Zer0dot
    @Zer0dot
    My .solcover.js just has the fork and block number in the provider options
    Let me know if anyone's got a clue!
    Zer0dot
    @Zer0dot
    Nevermind got it!
    Just needed to switch from using hardhat_reset to evm_snapshot and evm_revert
    jo-es
    @jo-es
    Hi. Is it possible to combine reports from multiple test runs via solidity-coverage? I have some test which run locally via hardhat evm and some which run via hardhat mainnet forking.
    cgewecke
    @cgewecke

    @jo-es Yes, it's possible! There's a (rough draft) recipe of how do this in a Circle CI script here:

    https://github.com/SetProtocol/index-coop-smart-contracts/blob/3b1521d0212b82477bcc4a543adc3909025a9dd7/.circleci/config.yml#L80-L166

    That might be over-complicated for your use case ... the basic idea is that you copy the coverage.json file generated by each test run to a unique file name (coverage.json is saved in your project's root directory). Then use a cli utility called istanbul-combine-updated to merge the jsons in a final step.

    https://www.npmjs.com/package/istanbul-combine-updated?activeTab=readme

    jo-es
    @jo-es
    thanks! 🙏 I'm going to try that.
    julianlen
    @julianlen

    You should be able to resolve by setting disableConfirmationListener: true in whatever network you use to run your tests.
    And you can tell solidity-coverage to use a user-defined network via the cli with --network <network-name>

    Hi everyone! Regarding this answer, I'm trying to run solidity-coverage over RSK. So I run a node in regtest (a local network), and then npx truffle run coverage --network rsk but it throws:

    Error: Port 4444 is already in use.

    What am I doing wrong?

    cgewecke
    @cgewecke
    @julianlen solidity-coverage doesn't connect to arbitrary nodes ... it only works with ganache and HardhatEVM. It needs to hook into their JS evms to track the execution path of your code. I think you're seeing that error because the tool is trying to launch a ganache server instance on the port specified by your RSK network.
    julianlen
    @julianlen
    Ok, i got it. Thank you!
    Philipp
    @Azamous
    Does anyone know how to fork mainnet for truffle coverage?
    cgewecke
    @cgewecke
    @Azamous You can configure the ganache instance solidity-coverage uses via the providerOptions in .solcover.js. This accepts all the options ganache-core supports in the same format. There's more about this in the README, here: https://github.com/sc-forks/solidity-coverage#config-options
    Philipp
    @Azamous

    @Azamous You can configure the ganache instance solidity-coverage uses via the providerOptions in .solcover.js. This accepts all the options ganache-core supports in the same format. There's more about this in the README, here: https://github.com/sc-forks/solidity-coverage#config-options

    Thank you, tried this, but fork was not commited. I am specifying fork like this in ProviderOptions:{
    port: 8545,
    fork: "https://mainnet.infura.io/v3/INFURA_ID",
    network_id: 1,
    default_balance_ether: 10000
    }
    Can you say if i am doing it correctly? Thanks in advance

    cgewecke
    @cgewecke
    @David-Kneel Responding in the issue you opened...
    David-Kneel
    @David-Kneel

    @David-Kneel Responding in the issue you opened...

    Great, thank you!

    Majd Turfa
    @MajdT51_gitlab
    HI guys i have this probelm : I'm using the ganache desktop app run on 127.0.0.1:8545 . The Port is used by ganache app and i want to run the coverage test on ganache app
    image.png
    Abdul Sami
    @abdulsamijay
    Hey guys,
    It is stated in the solidity-coverage npm page that coverage tool does not compile solidity smart contracts with optimizer on. It is also an open issue. Did anyone ever encounter this issue before ? Is there a work around to this ?
    Need help thanks.
    Cesar Brazon
    @cbrzn
    Is this repository being actively maintained?
    I was wondering if you're planning on tackling sc-forks/solidity-coverage#652
    Danilo Tuler
    @tuler
    Hey, just want to confirm latest solidity-coverage is not compatible with latest hardhat. Any beta version or fork out there?