Skip to content

Dev: Running Hardhat Coverage

zjlin edited this page Oct 14, 2022 · 1 revision

Test coverage

This documentation will guide you through running solidity test coverage analysis. It is very important that our smart contract unit tests, hit all statements, functions, and every possible branch. This is just a minimum requirement.

Requirements

In order to run coverage tool, you must have followed and completed the Dev: Building instructions, or just run

npm ci && npx hardhat clean && npx hardhat compile

in alicent/bridge

To run coverage on a specific smart contract, you have to be inside the bridge folder. Open a new terminal and navigate into alicenet/bridge

npx hardhat coverage --solcoverjs ./.solcover.ts --testfiles test/<nameOfTestDirectory>

To run coverage on all the contracts run

npx hardhat coverage --solcoverjs ./.solcover.ts