diff --git a/src/index.ts b/src/index.ts index 6ae510e25b..d22d5e70f5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -751,7 +751,6 @@ function parseOptions( { argv, partial }, ); } catch (e) { - assert(!partial, "Partial option parsing should not have failed"); return messageError("DriverCLIOptionParsingFailed", { message: exceptionToString(e), }); diff --git a/test/unit/cli-options.test.ts b/test/unit/cli-options.test.ts new file mode 100644 index 0000000000..44b22288c9 --- /dev/null +++ b/test/unit/cli-options.test.ts @@ -0,0 +1,15 @@ +import { describe, expect, test } from "vitest"; + +import { parseCLIOptions } from "../../src/index.js"; + +describe("CLI option parsing", () => { + test("reports a duplicate output option as a user input error", () => { + expect(() => + parseCLIOptions(["-o", "list.go", "-o", "list.ts"]), + ).toThrow(/^Option parsing failed: .*Singular option already set/); + + expect(() => + parseCLIOptions(["-o", "list.go", "-o", "list.ts"]), + ).not.toThrow("Internal error"); + }); +});