| author | |
| committer | |
| log | c9a59a26bb85902b9b2e828e1f99cc0760105ae4 |
| tree | aba4520ad03c8a231bb42f2713c17b7213b3138d |
| parent | e0fe4270aace7279696dd83be62990cbc7a84c63 |
- Treat `--` and `-...` tokens after value flags as missing values
- Add regression test for `--state-dir --continue` to throw the expected error2 files changed, 7 insertions(+), 1 deletions(-)
scripts/dev-runner.mjs+1-1| ... | ... | @@ -131,7 +131,7 @@ export function parseDevRunnerArgs(rawArgs) { |
| 131 | 131 | let value = parsedFlag.value; |
| 132 | 132 | if (value === undefined) { |
| 133 | 133 | const next = args[index + 1]; |
| 134 | if (next === undefined) { | |
| 134 | if (next === undefined || next === "--" || next.startsWith("-")) { | |
| 135 | 135 | throw new Error(`Missing value for --${parsedFlag.name}`); |
| 136 | 136 | } |
| 137 | 137 | value = next; |
scripts/dev-runner.test.ts+6| ... | ... | @@ -30,6 +30,12 @@ describe("parseDevRunnerArgs", () => { |
| 30 | 30 | it("throws when a value flag is missing its value", () => { |
| 31 | 31 | expect(() => parseDevRunnerArgs(["--state-dir"])).toThrow("Missing value for --state-dir"); |
| 32 | 32 | }); |
| 33 | ||
| 34 | it("throws when a value flag is followed by another flag token", () => { | |
| 35 | expect(() => parseDevRunnerArgs(["--state-dir", "--continue"])).toThrow( | |
| 36 | "Missing value for --state-dir", | |
| 37 | ); | |
| 38 | }); | |
| 33 | 39 | }); |
| 34 | 40 | |
| 35 | 41 | describe("createDevRunnerEnv", () => { |