diff --git a/.changeset/purple-cooks-remember.md b/.changeset/purple-cooks-remember.md new file mode 100644 index 0000000000..734bc468fb --- /dev/null +++ b/.changeset/purple-cooks-remember.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/gas-report": patch +--- + +Fixed gas report parsing for foundry versions released after 2024-02-15. diff --git a/packages/gas-report/ts/index.ts b/packages/gas-report/ts/index.ts index a7c14bdd32..322d71bd09 100644 --- a/packages/gas-report/ts/index.ts +++ b/packages/gas-report/ts/index.ts @@ -130,7 +130,9 @@ async function runGasReport(options: Options): Promise { 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--) {