-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
# Gas Report | ||
|
||
Gas reporter for specific lines within forge tests | ||
|
||
Add some reports to your forge tests | ||
|
||
```solidity | ||
import { Test } from "forge-std/Test.sol"; | ||
import { GasReporter } from "@latticexyz/gas-report/src/GasReporter.sol"; | ||
contract ExampleTest is Test, GasReporter { | ||
function testGas() public { | ||
startGasReport("Describe what is being gas-reported on"); | ||
// do something here | ||
endGasReport(); | ||
} | ||
} | ||
``` | ||
|
||
Then use the cli command to run tests and save the report: | ||
|
||
```console | ||
pnpm mud-gas-report --save gas-report.json | ||
``` | ||
|
||
Run `pnpm mud-gas-report --help` for more details. |