🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

solidity-coverage

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solidity-coverage

Code coverage for Solidity testing

0.8.16
latest
Version published
Weekly downloads
184K
16.04%
Maintainers
3
Weekly downloads
 
Created

What is solidity-coverage?

solidity-coverage is an npm package that provides code coverage metrics for Solidity smart contracts. It helps developers ensure that their tests cover all possible execution paths in their smart contracts, which is crucial for identifying potential vulnerabilities and ensuring the robustness of the code.

What are solidity-coverage's main functionalities?

Code Coverage Report

This feature allows you to generate a code coverage report for your Solidity smart contracts. By integrating solidity-coverage with your Truffle configuration, you can run your tests and get a detailed report on which lines of code were executed.

const coverage = require('solidity-coverage');
module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*',
    },
  },
  plugins: ['solidity-coverage'],
};

Integration with Truffle

solidity-coverage integrates seamlessly with the Truffle framework, allowing you to run your tests and generate coverage reports without additional setup. This integration simplifies the process of ensuring your smart contracts are thoroughly tested.

const coverage = require('solidity-coverage');
module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*',
    },
  },
  plugins: ['solidity-coverage'],
};

Command Line Interface

You can use the command line interface to run solidity-coverage directly from your terminal. This command will execute your tests and generate a coverage report, making it easy to incorporate into your CI/CD pipeline.

npx solidity-coverage

Other packages similar to solidity-coverage

FAQs

Package last updated on 07 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts