mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 18:42:25 +00:00
fix(e2e): reject flag Parallels smoke values
This commit is contained in:
@@ -20,7 +20,7 @@ export function parseBoolEnv(value: string | undefined): boolean {
|
||||
|
||||
export function ensureValue(args: string[], index: number, flag: string): string {
|
||||
const value = args[index + 1];
|
||||
if (value == null || value === "") {
|
||||
if (value == null || value === "" || value.startsWith("-")) {
|
||||
die(`${flag} requires a value`);
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -351,6 +351,25 @@ describe("Parallels smoke model selection", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects short flags as Parallels smoke option values", () => {
|
||||
const cases = [
|
||||
[TS_PATHS.linux, "--mode", "-h"],
|
||||
[TS_PATHS.macos, "--vm", "-h"],
|
||||
[TS_PATHS.windows, "--model", "-h"],
|
||||
[TS_PATHS.npmUpdate, "--target-tarball", "-h"],
|
||||
];
|
||||
|
||||
for (const [scriptPath, flag, value] of cases) {
|
||||
const result = spawnNodeEvalSync(
|
||||
`process.argv = ["node", "${scriptPath}", "${flag}", "${value}"]; await import("./${scriptPath}");`,
|
||||
{ env: process.env, imports: ["tsx"] },
|
||||
);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain(`error: ${flag} requires a value`);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps provider auth and model defaults in the shared TypeScript helper", () => {
|
||||
const providerAuth = readFileSync(TS_PATHS.providerAuth, "utf8");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user