question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gas report not shown per unit tests

See original GitHub issue

Hello,

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:open
  • Created a year ago
  • Reactions:8
  • Comments:7

github_iconTop GitHub Comments

4reactions
CJ42commented, Aug 22, 2022

Same problem, with a sample Hardhat setup, and I do not get the gas cost per unit test.

with Hardhat

image

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

image

0reactions
aolin118commented, Oct 26, 2022

same problem here

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found