Skip to content

Commit

Permalink
fix: gas report fails to find test filename
Browse files Browse the repository at this point in the history
  • Loading branch information
pwrstudio committed Feb 19, 2024
1 parent d1753d0 commit 5a2f702
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/gas-report/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ 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 (.*):(.*)$/;
// Match both old (before 2024-02-15) and new forge test output format
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 5a2f702

Please sign in to comment.