From a02da555b82b494acdef8cc5b8f58fc6760d1c07 Mon Sep 17 00:00:00 2001 From: PWR Date: Tue, 20 Feb 2024 21:56:03 +0100 Subject: [PATCH] fix(gas-report): update filename matcher (#2277) Co-authored-by: Kevin Ingersoll --- .changeset/purple-cooks-remember.md | 5 +++++ packages/gas-report/ts/index.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/purple-cooks-remember.md 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--) {