A tutorial that teaches how to profile the test coverage of your smart contracts using Hardhat and the Solidity Coverage plugin.
npx hardhat init
command.
To install manually, run npm install -D solidity-coverage
.
Then, import solidity-coverage
in hardhat.config.ts
:
coverage
becomes available via the npx hardhat coverage
command.
Lock.test.ts
:
npx hardhat coverage
, you should get:
coverage
, which was generated by the solidity-coverage
plugin. Inside the coverage
folder there is a index.html
file. Open it in a browser, you’ll see a report similar to the following:
_unlockTime
has to be greater than the block.timestamp
:
npx hardhat coverage
and you should get: