Gas report not shown per unit tests
See original GitHub issueHello,
My npx hardhat test command doesn’t generate gas report per unit tests,
But instead, it will only show the gas report at the end of the test.
How to enable this?
Thanks.
My hardhat config btw
gasReporter: {
enabled: true,
currency: 'USD',
showMethodSig: true,
},
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:7
Top Results From Across the Web
Issues · cgewecke/hardhat-gas-reporter - GitHub
Gas usage per unit test. Average gas usage per method. (eth-gas-reporter for Hardhat) - Issues · cgewecke/hardhat-gas-reporter.
Read more >hardhat-gas-reporter - npm
Hardhat plugin for eth-gas-reporter, a mocha reporter for Ethereum test suites. Latest version: 1.0.9, last published: 4 months ago.
Read more >Is there a way to set gas fees to 0 for unit tests in ethers js?
Install and run Ganache, then run your tests npx hardhat test --network ganache , in Ganache you'll be able to see how much...
Read more >eth-gas-reporter | Yarn - Package Manager
A Mocha reporter for Ethereum test suites: Gas usage per unit test. Metrics for method calls and deployments. National currency costs of deploying...
Read more >Unit testing and deploying smart contracts with Forge
Sweet! If you have noticed, we have console.log statements in our test cases, but they are not showing up ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Same problem, with a sample Hardhat setup, and I do not get the gas cost per unit test.
with Hardhat ❌
However, with truffle, I do get the gas cost per unit test (in the screenshot below, the unit tests not showing the gas cost only use view functions, therefore the reason no gas costs are reported):
with Truffle ✅
same problem here