mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(scripts): reject short flag performance summary paths
This commit is contained in:
parent
6399eb8191
commit
8102d5ebc3
2 changed files with 2 additions and 1 deletions
|
|
@ -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`,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue