diff --git a/gas-report.sh b/gas-report.sh new file mode 100755 index 0000000..ae3d09a --- /dev/null +++ b/gas-report.sh @@ -0,0 +1,2 @@ +#!/bin/bash +forge test --gas-report 2>&1 | (tee /dev/tty | awk '/Test result:/ {found=1; buffer=""; next} found && !/Ran/ {buffer=buffer $0 ORS} /Ran/ {found=0} END {printf "%s", buffer}' > .gas-report) \ No newline at end of file diff --git a/package.json b/package.json index 6ba47b1..8ad4e99 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "lint:sol": "forge fmt --check && pnpm solhint {script,src,test,certora}/**/*.sol", "prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore", "prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore", - "gas:report": "forge test --gas-report 2>&1 | (tee /dev/tty | awk '/Test result:/ {found=1; buffer=\"\"; next} found && !/Ran/ {buffer=buffer $0 ORS} /Ran/ {found=0} END {printf \"%s\", buffer}' > .gas-report)" + "gas:report": "./gas-report.sh" } } \ No newline at end of file