fix(test): reject loose env report limits

This commit is contained in:
Vincent Koc
2026-06-21 13:37:55 +02:00
parent b7fef7fca6
commit e6f41a4df0
2 changed files with 37 additions and 5 deletions

View File

@@ -182,4 +182,29 @@ describe("collectTestEnvMutationReport", () => {
expect(result.status).toBe(1);
expect(result.stderr).toContain("--repo-root expects a path");
});
it("rejects loose CLI limits before scanning the repository", () => {
for (const limit of ["1e3", ""]) {
const result = spawnSync(
process.execPath,
[
"--import",
"tsx",
path.join(process.cwd(), "scripts/test-env-mutation-report.ts"),
"--",
"--limit",
limit,
"--repo-root",
createTempDir("openclaw-env-limit-"),
],
{
encoding: "utf8",
},
);
expect(result.status).toBe(1);
expect(result.stderr).toContain("--limit expects a non-negative integer");
expect(result.stdout).not.toContain("Scanned files:");
}
});
});