-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: forge test --gas-report --json
yields unexpected data and misses data
#8789
Comments
forge test --gas-report --json
yields unexpected dataforge test --gas-report --json
yields unexpected data and misses data
I think this is part of a larger issue we should think about holistically - all commands should output the same information with |
Would be very interesting such feature, because we can link follow up the metrics of gas usage in the contract as per commit basis, specially when running tasks on CI, and git hooks. |
Suggestion for the output format: https://bencher.dev/docs/reference/bencher-metric-format/ Additional info: https://bencher.dev/docs/how-to/track-custom-benchmarks/ Not sure if there are other standards out there, but using this format would allow for an easy adapter to Bencher. |
@beeb Looks good. Would be good if gas snapshot and gas report become a single file, as their information are complementary. I mean, gas-snapshot is the summary of gas costs for the tests, while gas-report is the individual cost of each operation on the smart contracts used by the tests. I think that this feature would help us detect bad efficiencies in the code. |
Yes, it would be good if the result of gas report can be written to a single file. I love this feature. |
The proposed JSON output in #9063 looks as follows:
Equivalent to:
Each test suite is rendered on a new line and can easily be parsed with |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (d75318c 2024-09-02T00:21:21.377809037Z)
What command(s) is the bug in?
forge test --gas-report --json
Operating System
Linux
Describe the bug
forge test --gas-report
yields:Whereas
forge test --gas-report --json | jq
yields:Which are the results of running the test whereas I would assume
--json
would yield a JSON representation of the table layout:This would address the feature raised in #8781
A possible format could be:
The text was updated successfully, but these errors were encountered: