mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 02:06:43 +00:00
fix(scripts): reject short flag performance summary paths
This commit is contained in:
@@ -8,7 +8,7 @@ import { pathToFileURL } from "node:url";
|
||||
|
||||
function readOptionValue(argv, index, optionName) {
|
||||
const value = argv[index + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`${optionName} requires a value`);
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -134,6 +134,7 @@ describe("parseArgs", () => {
|
||||
for (const flag of ["--source-dir", "--baseline-source-dir", "--output"]) {
|
||||
expect(() => parseArgs([flag])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, ""])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, "--source-dir", "reports/current"])).toThrow(
|
||||
`${flag} requires a value`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user