Skip to content

Commit 91bf012

Browse files
committed
test(cli): preserve negated option argument delegation
1 parent 0381b56 commit 91bf012

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

tests/vinext-proxy.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ describe("thin vinext command proxies", () => {
152152
}
153153
});
154154

155+
it("leaves positional arguments after a negated boolean to Vite", () => {
156+
const root = createRoot();
157+
const result = spawnSync(
158+
process.execPath,
159+
[CLI_PATH, "build", "--no-watch", "false", "project"],
160+
{ cwd: root, encoding: "utf-8" },
161+
);
162+
163+
expect(result.status).toBe(1);
164+
expect(`${result.stdout}\n${result.stderr}`).toContain("Unused args: `project`");
165+
expect(result.stderr).not.toContain("No Vite config was found");
166+
});
167+
155168
it.each([
156169
{ args: ["--mode"] },
157170
{ args: ["--mode="] },

tests/vite-cli-invocation.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ describe("isViteCliInvocation", () => {
210210
});
211211

212212
it("keeps the next positional argument after a negated option", () => {
213+
expect(findViteRoot("build", ["--no-watch", "false", "project"])).toEqual({
214+
root: "false",
215+
shouldPreflight: false,
216+
});
213217
expect(
214218
getViteCliInvocation([
215219
"node",

0 commit comments

Comments
 (0)