0.7.0-beta
Pre-releaseHello!
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
- Options and other instructions
- A guide to upgrading from 0.6.x to 0.7.x
- Some notes on advanced use cases
🐘 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 ;)