fix(test): reject diff ref flag values · openclaw/openclaw@7069d95
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ const MAX_TERM_LENGTH = 80;
|
24 | 24 | |
25 | 25 | function readRefOptionValue(argv, index, optionName) { |
26 | 26 | const value = argv[index + 1]; |
27 | | -if (value === undefined || value === "" || value.startsWith("--")) { |
| 27 | +if (value === undefined || value === "" || value.startsWith("-")) { |
28 | 28 | throw new Error(`${optionName} requires a value`); |
29 | 29 | } |
30 | 30 | return value; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -62,7 +62,7 @@ function resolveCommit({ ref, cwd, maxBuffer }) {
|
62 | 62 | |
63 | 63 | function readRefValue(argv, index, optionName) { |
64 | 64 | const value = argv[index + 1]; |
65 | | -if (value === undefined || value === "" || value.startsWith("--")) { |
| 65 | +if (value === undefined || value === "" || value.startsWith("-")) { |
66 | 66 | throw new Error(`${optionName} requires a value`); |
67 | 67 | } |
68 | 68 | return value; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,7 +11,11 @@ describe("check-docs-i18n-glossary", () => {
|
11 | 11 | |
12 | 12 | it("rejects missing diff ref values", () => { |
13 | 13 | expect(() => parseArgs(["--base", "--head", "HEAD"])).toThrow("--base requires a value"); |
| 14 | +expect(() => parseArgs(["--base", "-h", "--head", "HEAD"])).toThrow( |
| 15 | +"--base requires a value", |
| 16 | +); |
14 | 17 | expect(() => parseArgs(["--head"])).toThrow("--head requires a value"); |
| 18 | +expect(() => parseArgs(["--head", "-h"])).toThrow("--head requires a value"); |
15 | 19 | expect(() => parseArgs(["--base", ""])).toThrow("--base requires a value"); |
16 | 20 | }); |
17 | 21 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,11 @@ describe("merge-head-diff-base", () => {
|
12 | 12 | |
13 | 13 | it("rejects missing refs", () => { |
14 | 14 | expect(() => parseArgs(["--base", "--head", "HEAD"])).toThrow("--base requires a value"); |
| 15 | +expect(() => parseArgs(["--base", "-h", "--head", "HEAD"])).toThrow( |
| 16 | +"--base requires a value", |
| 17 | +); |
15 | 18 | expect(() => parseArgs(["--head"])).toThrow("--head requires a value"); |
| 19 | +expect(() => parseArgs(["--head", "-h"])).toThrow("--head requires a value"); |
16 | 20 | expect(() => parseArgs(["--base", ""])).toThrow("--base requires a value"); |
17 | 21 | }); |
18 | 22 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。