@latticexyz/gas-report
Advanced tools
Comparing version 2.0.0-next.18 to 2.0.0-next-17-awakening-9c07ab3a2
#!/usr/bin/env node | ||
import{a as r}from"./chunk-YTD6WQQA.js";import i from"yargs";import{hideBin as s}from"yargs/helpers";import*as a from"dotenv";import e from"chalk";a.config();r.command="$0";i(s(process.argv)).scriptName("gas-report").command(r).strict().fail(o=>{console.error(e.red(o)),o.includes("Missing required argument")&&console.log(e.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`)),process.exit(1)}).alias({h:"help"}).argv; | ||
import{a as r}from"./chunk-OPZOQG5Z.js";import i from"yargs";import{hideBin as s}from"yargs/helpers";import*as a from"dotenv";import e from"chalk";a.config();r.command="$0";i(s(process.argv)).scriptName("gas-report").command(r).strict().fail((o,n)=>{console.error(e.red(o)),o.includes("Missing required argument")&&console.log(e.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`)),process.exit(1)}).alias({h:"help"}).argv; | ||
//# sourceMappingURL=gas-report.js.map |
@@ -1,2 +0,2 @@ | ||
import{a}from"./chunk-YTD6WQQA.js";export{a as default}; | ||
import{a}from"./chunk-OPZOQG5Z.js";export{a as default}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@latticexyz/gas-report", | ||
"version": "2.0.0-next.18", | ||
"version": "2.0.0-next-17-awakening-9c07ab3a2", | ||
"description": "Gas reporter for specific lines within forge tests", | ||
@@ -43,2 +43,3 @@ "repository": { | ||
}, | ||
"gitHead": "914a1e0ae4a573d685841ca2ea921435057deb8f", | ||
"scripts": { | ||
@@ -45,0 +46,0 @@ "build": "tsup", |
@@ -29,5 +29,5 @@ # Gas Report | ||
```console | ||
GAS_REPORTER_ENABLED=true forge test -vvv --isolate | pnpm gas-report --stdin | ||
GAS_REPORTER_ENABLED=true forge test -vvv | pnpm gas-report --stdin | ||
``` | ||
Run `pnpm gas-report --help` for more details. |
@@ -24,7 +24,7 @@ #!/usr/bin/env node | ||
// Custom error handler | ||
.fail((msg) => { | ||
.fail((msg, err) => { | ||
console.error(chalk.red(msg)); | ||
if (msg.includes("Missing required argument")) { | ||
console.log( | ||
chalk.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`), | ||
chalk.yellow(`Run 'pnpm mud ${process.argv[2]} --help' for a list of available and required arguments.`) | ||
); | ||
@@ -31,0 +31,0 @@ } |
@@ -117,3 +117,3 @@ import type { CommandModule } from "yargs"; | ||
// Run the default test command to capture the logs | ||
const child = execa("forge", ["test", "-vvv", "--isolate"], { | ||
const child = execa("forge", ["test", "-vvv"], { | ||
stdio: ["inherit", "pipe", "inherit"], | ||
@@ -124,3 +124,2 @@ env: { GAS_REPORTER_ENABLED: "true" }, | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} catch (error: any) { | ||
@@ -136,5 +135,3 @@ console.log(error.stdout ?? error); | ||
const testFunctionPattern = /^\[(?:PASS|FAIL).*\] (\w+)\(\)/; | ||
// 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 (.*):(.*)$/; | ||
const testFilePattern = /^Running \d+ tests? for (.*):(.*)$/; | ||
@@ -141,0 +138,0 @@ function nearestLine(pattern: RegExp, startIndex: number = lines.length - 1): number { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30337
257