Skip to content

Releases: sc-forks/solidity-coverage

0.7.0-beta

25 Sep 08:15

Choose a tag to compare

0.7.0-beta Pre-release
Pre-release

Hello!

Solidity-Coverage is undergoing a major re-design in 0.7.0....

Its core remains the elegant solidity instrumentation logic which JoinColony engineer @area first worked out in 2016. But the mechanics of collecting your tests' execution trace and the tool's integration with the Ethereum development stack have been re-written to fix a host of problems that have built up over the last two years. Beginning with this release, you'll

  • be able to use any Ganache version you want
  • slot coverage into your other tooling as a plugin with much less configuration
  • run into far fewer cases where normally working tests fail when being covered

We've also focused on improving error reporting and making overall performance smoother. It's been beta tested on a handful of large projects and everything looks good - worth checking out :)

What to do

Install

$ npm install --save-dev solidity-coverage@beta

Add this package to your plugins array in truffle-config.js

module.exports = {
  networks: {...},
  plugins: ["solidity-coverage"]
}

Run

truffle run coverage [command-options]

Documentation

🐘 What's coming... 🐘

There are two more phases of development planned for solidity-coverage in the next couple of months:

Phase 2: We'll publish a Buidler plugin and finalize a general API which lets you use this tool with any development setup.

Phase 3: We'll implement a set of new, solidity-specific coverage measurements which engineers have proposed over the years to increase the precision of the reports you get:

  • Per-function modifier coverage , which treats modifiers as branches in the code for each function, e.g for each method qualified by the modifier Ownable, measure whether it was called by owners and non-owners (Proposed by Zeppelin engineer Nicolas Venturo in solidity-coverage #286)
  • Public variable coverage, which treats public variables as methods (since getters are implicitly generated for them) and provide a way for developers to track changes in their contracts' public API. (Proposed by Zeppelin engineer Nicolas Venturo in solidity-coverage #281)
  • && / || conditional coverage: , which treats conjoined conditions as distinct execution branches. This precision in branch coverage reporting is available for Java with the cobratura coverage tool - Solidity could benefit from it too. (Proposed by Gnosis engineer Richard Meissner in solidity-coverage #175)
  • Documentation coverage, which measures Natspec comment-to-parameter mappings and provides a way to track documentation completeness
  • CI integrations for the above Where additional coverage measurements can't be adequately represented by Istanbul/Coveralls we'll add support for them with a githooks/CI integration that tracks pull-request changes relative to their target branch.

Thanks for trying this out!

Please open issues/ask for help if you run into trouble installing or see problems ;)

v0.6.4

02 Aug 04:12

Choose a tag to compare

🐘 🐘

This release upgrades the coverage client testrpc-sc to 6.5.1, tracking ganache-cli. There are some long-awaited bug fixes arriving from upstream...

  • Block timestamps no longer float within a given block. The non-static (and erroneous) behavior was especially noticeable when running coverage because it's slower.
  • The value of eth_blockNumber and the Solidity global block.number are now identical, instead of off-by-one.

Thanks to @barakman for reporting and keeping on top of these.

v0.6.x

12 Jul 08:34

Choose a tag to compare

Hello 🐘

This release resolves several long-standing issues:

  • Instrumentation speeds have improved dramatically (i.e by orders of magnitude, thanks to the LeapDao fork.)
  • Parsing is now managed by @federicobond's wonderful solidity-parser-antlr and current with the latest solidity syntax. (Thanks to @area)
  • testrpc-sc has been rebased to ganache-cli 6.4.5 It's petersburg enabled and runs with the --allowUnlimitedContractSize and --emitFreeLogs flags already on by default. Coverage no longer distorts gas measurements within solidity code.
  • all PRs are E2E tested against the latest state of the openzeppelin-solidity repo.

Apologies to all for the gap in development here in 2018/2019 - regular maintainer @cgewecke vanished without trace or explanation for months.

Credits and Kudos to...
JoinColony's @area, LeapDao's @pinkiebell, HQ20's @obernardovieira and the contributors to #318 for getting SC to work with newer Solidity and the Petersburg fork.

Also to Ripio's @Agusx1211 for getting --emitFreeLogs into ethereumjs-vm. Brilliant.

Hoping to implement some changes here in July/August to instrument files without using events and make the tool artifact-type neutral. Generating coverage for solidity is a little tricky and it's not clear anyone has discovered a perfect way to do it. If this package isn't working for you, it's well worth checking out two other options:

-cg