diff --git a/scripts/docker-e2e-timings.mjs b/scripts/docker-e2e-timings.mjs index bf196fc52cf1..fe9a58475327 100644 --- a/scripts/docker-e2e-timings.mjs +++ b/scripts/docker-e2e-timings.mjs @@ -25,6 +25,8 @@ function parseArgs(argv) { options.limit = readLimit(argv[(index += 1)]); } else if (arg?.startsWith("--limit=")) { options.limit = readLimit(arg.slice("--limit=".length)); + } else if (arg?.startsWith("-")) { + throw new Error(`unknown argument: ${arg}\n${usage()}`); } else if (!options.file) { options.file = arg; } else { diff --git a/test/scripts/docker-e2e-helper-cli.test.ts b/test/scripts/docker-e2e-helper-cli.test.ts index e301251b373e..a08e5d1b0014 100644 --- a/test/scripts/docker-e2e-helper-cli.test.ts +++ b/test/scripts/docker-e2e-helper-cli.test.ts @@ -91,6 +91,20 @@ describe("Docker E2E helper CLIs", () => { expect(result.stderr).not.toContain("at file:"); }); + it("rejects unknown timings options without treating them as artifact paths", () => { + const result = runHelper("scripts/docker-e2e-timings.mjs", "--wat"); + + expect(result.status).toBe(1); + expect(result.stdout).toBe(""); + expect(result.stderr).toContain("unknown argument: --wat"); + expect(result.stderr).toContain( + "Usage: node scripts/docker-e2e-timings.mjs ", + ); + expect(result.stderr).not.toContain("ENOENT"); + expect(result.stderr).not.toContain("Error:"); + expect(result.stderr).not.toContain("at file:"); + }); + it("rejects oversized timing JSON artifacts without a Node stack trace", () => { const root = mkdtempSync(`${tmpdir()}/openclaw-docker-e2e-timings-`); try {