Skip to content

Commit

Permalink
fix(gas-report): update filename matcher (#2277)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
pwrstudio and holic authored Feb 20, 2024
1 parent 16121e8 commit a02da55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/purple-cooks-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/gas-report": patch
---

Fixed gas report parsing for foundry versions released after 2024-02-15.
4 changes: 3 additions & 1 deletion packages/gas-report/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ async function runGasReport(options: Options): Promise<GasReport> {
const lines = logs.split("\n").map(stripAnsi);
const gasReportPattern = /^\s*GAS REPORT: (\d+) (.*)$/;
const testFunctionPattern = /^\[(?:PASS|FAIL).*\] (\w+)\(\)/;
const testFilePattern = /^Running \d+ tests? for (.*):(.*)$/;
// Matches "Running" for forge versions before 2024-02-15
// And "Ran" for forge versions after 2024-02-15
const testFilePattern = /^(?:Running|Ran) \d+ tests? for (.*):(.*)$/;

function nearestLine(pattern: RegExp, startIndex: number = lines.length - 1): number {
for (let i = startIndex; i >= 0; i--) {
Expand Down

0 comments on commit a02da55

Please sign in to comment.