Solidity-coverage recognizes not a single line of tested code?

Hi everybody.

I’ve done solidity-coverage but it won’t track any single line of code. Has anybody faced the same issue?

In my tests, I adopted the approach from OpenZeppelin-ETH to use mocks of my contracts, that inherits from the base contracts encapsulating the initialize-method into a constructor like here: https://github.com/itinance/ncd-token/blob/master/contracts/mocks/NCDTokenSaleImpl.sol.

Of the Impl-File 100% coverage was recognized. But the underlying NCDTokenSale-file zero lines where recognized in coverage although plenty of tests (58) were ran.

2 Likes

I have asked also on their repository at GitHub: https://github.com/sc-forks/solidity-coverage/issues/330

1 Like

@itinance It looks your issue was solved through config.

Feel free to share any advice on solidity coverage with the community. e.g. having to use solidity-coverage@beta with ZeppelinOS.

1 Like

Although I have much appreciated this PR from cgewecke, that you have mentioned, it caused other weird issues were beforeEach-functions cause a revert on the VM, that not would appear on ganache: https://github.com/sc-forks/solidity-coverage/issues/330#issuecomment-507851817

1 Like

Ah, this was my fault! I used a different version of coverage as intended by @cgewecke in his PR :slight_smile:

Explicitly upgrading to solidity-coverage@0.6.0-beta.5 makes it work without the issues mentioned in my previous comment.

I already added this info on my GitHub issue.

1 Like

One thing I’ve learned and I consider very important is to have fixed versions on dependencies. It is always changing and if we don’t control the versions it might be broken tomorrow. Same applies for solidity-coverage. It’s funny that it was maintained for a long time after solidity 0.5 was released, so me and other people fixed that and eventually @area showed up and oppened a PR. But keep in mind that even what is happening around that PR, is fixing a lot of stuff, but breaking some other. I wish I have more time to help fix such important tool.

2 Likes

Hi @itinance

Is your test coverage being reported appropriately now?
Can we mark this question as solved?

1 Like

Yes. PR from cgewecke solved my issue after I also had upgraded dependencies.

1 Like