Skip to content

Commit 94fc547

Browse files
committed
test: change it.fails to it for -n=John alias test
The parser fix makes this test pass, so it.fails is no longer needed.
1 parent e77c431 commit 94fc547

File tree

1 file changed

+18
-31
lines changed

1 file changed

+18
-31
lines changed

test/parser.test.ts

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,37 +41,6 @@ describe("parseRawArgs", () => {
4141
});
4242
});
4343

44-
it("handles -<arg>=<value> with short alias for boolean", () => {
45-
const result = parseRawArgs(["-v=true"], {
46-
boolean: ["verbose"],
47-
alias: {
48-
v: ["verbose"],
49-
},
50-
});
51-
52-
expect(result).toEqual({
53-
_: [],
54-
v: true,
55-
verbose: true,
56-
});
57-
});
58-
59-
it("handles -<arg>=<value> with multiple short aliases", () => {
60-
const result = parseRawArgs(["-o=output.txt"], {
61-
string: ["output", "out"],
62-
alias: {
63-
o: ["output"],
64-
O: ["out"],
65-
},
66-
});
67-
68-
expect(result).toEqual({
69-
_: [],
70-
o: "output.txt",
71-
output: "output.txt",
72-
});
73-
});
74-
7544
it("handles default values", () => {
7645
const result = parseRawArgs([], { default: { name: "Default" } });
7746

@@ -191,4 +160,22 @@ describe("parseRawArgs", () => {
191160
verbose: false,
192161
});
193162
});
163+
164+
it("coerces --flag=true to boolean true for boolean args", () => {
165+
const result = parseRawArgs(["--flag=true"], { boolean: ["flag"] });
166+
expect(result.flag).toBe(true);
167+
expect(typeof result.flag).toBe("boolean");
168+
});
169+
170+
it("coerces --flag=false to boolean false for boolean args", () => {
171+
const result = parseRawArgs(["--flag=false"], { boolean: ["flag"] });
172+
expect(result.flag).toBe(false);
173+
expect(typeof result.flag).toBe("boolean");
174+
});
175+
176+
it("coerces string arg without value to empty string (not boolean true)", () => {
177+
const result = parseRawArgs(["--nightly"], { string: ["nightly"] });
178+
expect(result.nightly).toBe("");
179+
expect(typeof result.nightly).toBe("string");
180+
});
194181
});

0 commit comments

Comments
 (0)