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

Created on 1 Jul 2019  路  3Comments  路  Source: sc-forks/solidity-coverage

Hi everybody :)

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

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 xxx-Impl-Files 100% coverage was recognized. But the underlying NCDTokenSale-file as example (like all the others) there were zero lines recognized in coverage although plenty of tests (58) were ran.

This is how it looks like:

Screenshot 2019-07-01 22 30 16

The files with red colors are the files with code, the green lines are the files consisting only as a proxy with inheriting from the actual contracts.

Anything I can do here without rewriting any tests to use no Mock-contracts?

Most helpful comment

This looks like it was a config problem - have opened a PR in NCD which should resolve.

All 3 comments

This looks like it was a config problem - have opened a PR in NCD which should resolve.

[SOLVED, see below]

Thank you so much! I have tried it out, but are running in several "invalid opcode"-exceptions in beforeEach-functions, that aren't an issue running on ganache-cli.

They even happen in very simple tests like https://github.com/itinance/ncd-token/blob/master/test/NCDTokenBasicTests.js#L16.

What could be the root cause here?

Screenshot 2019-07-02 23 25 03

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

Again, thank you so much! Really appreciated.

Explicitly upgrading to [email protected] makes it work without the issues mentioned in my previous comment.

Was this page helpful?
0 / 5 - 0 ratings