mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(qa): reject duplicate gateway startup controls
This commit is contained in:
parent
524e19726f
commit
c308295cd3
2 changed files with 10 additions and 0 deletions
|
|
@ -206,12 +206,19 @@ function readRequiredFlagValue(argv: string[], index: number, flag: string): str
|
|||
}
|
||||
|
||||
function validateCliArgs(argv: string[]): void {
|
||||
const seenSingleValueFlags = new Set<string>();
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index] ?? "";
|
||||
if (BOOLEAN_FLAGS.has(arg)) {
|
||||
continue;
|
||||
}
|
||||
if (VALUE_FLAGS.has(arg)) {
|
||||
if (arg !== "--case") {
|
||||
if (seenSingleValueFlags.has(arg)) {
|
||||
throw new CliArgumentError(`${arg} was provided more than once`);
|
||||
}
|
||||
seenSingleValueFlags.add(arg);
|
||||
}
|
||||
readRequiredFlagValue(argv, index, arg);
|
||||
index += 1;
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ describe("gateway startup benchmark script", () => {
|
|||
expect(() => testing.parseOptions(["--case", "default", "--case", "default"])).toThrow(
|
||||
'Duplicate --case "default"',
|
||||
);
|
||||
expect(() =>
|
||||
testing.parseOptions(["--output", "first.json", "--output", "second.json"]),
|
||||
).toThrow("--output was provided more than once");
|
||||
expect(() => testing.resolveEntry("--inspect")).toThrow(/must be a file path/u);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue