feat(forge test
): generate gas report of all functions in contract without the need to specify a test function for each
#8713
Labels
A-gas-snapshots
Area: gas snapshotting/reporting
C-forge
Command: forge
Cmd-forge-test
Command: forge test
T-feature
Type: feature
Component
Forge
Describe the feature you would like
The problem is that to obtain a gas report for an entire contract, we currently need to write test cases for each function within the contract. This is necessary to get accurate gas usage data. I'm looking for a way to generate a gas report without the need to write test cases for every function, if possible. Remix IDE offers something similar, but the results aren't very accurate.
A potential workaround is to build a script that automatically prefixes all functions in a contract with "test_" and then run forge snapshot to generate the gas report. However, if there were a way to achieve this without modifying the contract or writing specific test cases, it would be a much better solution.
Additional context
This feature would streamline the process of gas reporting, especially for large contracts where writing individual test cases for every function is cumbersome.
#4486
The text was updated successfully, but these errors were encountered: