question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zero percent coverage

See original GitHub issue

node: 10.1.0 npm: 5.6.0 truffle: 4.1.8

Unable to get any reported coverage of a contract implementation, although it does show 100% of the interface is covered.


Contract is setup similar to:

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Interface β”‚  β”‚ Library β”‚
    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    β”‚ +methodA  β”‚        β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
         β”‚               β”‚
         β”‚               β”‚
         β”‚               β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
    β”‚ Contract     β”‚     β”‚
    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€     β”‚
    β”‚ +libraryProp β”‚β”€β”€β”€β”€β”€β”˜
    β”‚ +methodA     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

After installing, and running, solidity-coverage we get the following:

---------------------|----------|----------|----------|----------|----------------|
File                 |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
---------------------|----------|----------|----------|----------|----------------|
 contracts/          |        0 |        0 |        0 |        0 |                |
  Contract.sol       |        0 |        0 |        0 |        0 |... 411,412,414 |
  Interface.sol      |      100 |      100 |      100 |      100 |                |
---------------------|----------|----------|----------|----------|----------------|
All files            |        0 |        0 |        0 |        0 |                |
---------------------|----------|----------|----------|----------|----------------|

On the first run we’re also experiencing the following error:

Event trace could not be read.
Error: ENOENT: no such file or directory, open './allFiredEvents'
Exiting without generating coverage...

To work around this we do a % touch ./allFiredEvents, and then re-run ./node_modules/.bin/solidity-coverage.

Also, after adding some more in-depth code/tests, we also start running into:

Error: VM Exception while processing transaction: out of gas
...

although regular unit tests run just fine. Also, the coverage is still generated

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cgeweckecommented, Jun 4, 2018

Ok great - you just need to capture the process ID of the testrpc-sc instance you’re launching in the container and kill it explicitly when the test run stops (or detect an existing instance and use that instead of launching a new one). There’s an example of doing this in a shell script at zeppelin-solidity here.

Oh sorry - I just read the whole note - solidity-coverage should be killing the testrpc successfully if you’re not launching it separately. Are you using the latest version?

0reactions
cgeweckecommented, Jun 4, 2018

@juztin Sweet, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Coverage is showing 0% for java projects - SonarQube
Hi, We have recently upgraded our sonar application from 7.1 to 7.9.6 (LTS in 7.x). We have observed that code coverage is showing...
Read more >
Code Coverage percentage is 0% in SonarQube Dashboard
We are trying to run theCode Coverage Pipeline job in Jenkins then we are getting the below error and the Coverage is showing...
Read more >
code coverage shows zero percentage - SonarQube
code coverage shows zero percentage - SonarQube ... Code coverage for both front end code(JavaScript) & back end code(java) shows 0%.
Read more >
Test coverage overview
Test coverage reports tell you what percentage of your code is covered by your test cases. Test execution reports tell you which tests...
Read more >
MUnit Test Coverage is getting calculated as zero percent ...
When using a Mock operation in MUnit tests, the coverage is getting calculated as zero percent (0.00%) for custom connector downloaded from Exchange....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found