Welcome to Solidity-Coverage

solidity-coverage is a code coverage tool for Solidity testing, designed to help developers ensure their smart contracts are thoroughly tested. It integrates seamlessly with the Hardhat development environment.

This tool instruments your Solidity contracts to track which lines, branches, functions, and statements are executed during your test runs. After the tests complete, it generates detailed reports showing what percentage of your code is covered, helping you identify untested paths and improve your test suite's quality.

Coverage Example

For a deeper dive into how it works and its potential limitations, you can read the accompanying article.

Key Features

  • Hardhat Integration: Works as a Hardhat plugin for a smooth developer experience.
  • Comprehensive Reports: Generates Istanbul reports in various formats (HTML, LCOV, text, JSON), providing detailed insights into line, function, statement, and branch coverage.
  • Highly Configurable: Offers a wide range of options through a .solcover.js file to tailor the coverage run to your project's specific needs, including skipping files, configuring test runners, and more.
  • Advanced Workflows: Supports advanced use cases like workflow hooks for custom scripts, test matrix generation for fault localization, and CI parallelization.
  • Developer Focused: Provides tools and troubleshooting guides for common issues like memory limits, stack-too-deep errors, and plugin conflicts.

Funding

Development of solidity-coverage is supported by the community. You can help fund its development through DRIPS, a public goods protocol that helps distribute funds to packages in your dependency tree.

The project has also received support via Optimism's Retroactive Public Goods Funding.