hardhat-gas-reporter icon indicating copy to clipboard operation
hardhat-gas-reporter copied to clipboard

Gas report not shown per unit tests

Open ghost opened this issue 2 years ago • 6 comments

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,
  },

ghost avatar Jun 28 '22 06:06 ghost

Same problem, only can get time spent on specific function by adding showTimeSpent: true

vladikopl01 avatar Jul 05 '22 12:07 vladikopl01

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

CJ42 avatar Jul 27 '22 15:07 CJ42

got same problem. hardhat is running in forked mode

hardhat: 2.9.9 hardhat-gas-reporter: 1.0.8

vetal20600 avatar Aug 15 '22 13:08 vetal20600

Same problem, only can get time spent on specific function by adding showTimeSpent: true

true

vetal20600 avatar Aug 15 '22 13:08 vetal20600

interesting that gas outputs when testing against ropsten

vetal20600 avatar Aug 15 '22 13:08 vetal20600

Got same problem here

nxqbao avatar Aug 30 '22 15:08 nxqbao

same problem here

aolin118 avatar Oct 26 '22 03:10 aolin118

ever figure this out?

"hardhat-gas-reporter": "^1.0.9",

not reporting gas per test

jacobmakarsky avatar Jun 09 '23 02:06 jacobmakarsky

Apologies, this behavior was only available in eth-gas-reporter and it slows the plugin down enormously because it has to use sync network calls to work with the mocha reporter.

Am going to add additional tasks in v2.0 that let you add gas tracking to any hardhat script and look at different scenario costs.

Closing for now....

cgewecke avatar Jan 31 '24 03:01 cgewecke