Skip to content

Commit

Permalink
docs(gas-report): add stdin example to readme (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Nov 10, 2023
1 parent aacffcb commit b37dec9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/gas-report/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gas Report

Gas reporter for specific lines within forge tests
Measure and report gas usage within forge tests

Add some reports to your forge tests

Expand All @@ -10,7 +10,7 @@ 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");
startGasReport("description of behavior to measure gas for");
// do something here
endGasReport();
}
Expand All @@ -23,4 +23,10 @@ Then use the cli command to run tests and save the report:
pnpm gas-report --save gas-report.json
```

Or, if you have your own test command, you can pipe the output to `gas-report --stdin`:

```console
GAS_REPORTER_ENABLED=true forge test -vvv | pnpm gas-report --stdin
```

Run `pnpm gas-report --help` for more details.

0 comments on commit b37dec9

Please sign in to comment.