@@ -195,6 +195,61 @@ describe("scripts/changed-lanes", () => {
|
195 | 195 | expect(result.stdout).not.toContain("[check:changed]"); |
196 | 196 | }); |
197 | 197 | |
| 198 | +it("rejects unknown changed lane options before treating them as paths", () => { |
| 199 | +const result = spawnSync(process.execPath, ["scripts/changed-lanes.mjs", "--jsno"], { |
| 200 | +cwd: repoRoot, |
| 201 | +encoding: "utf8", |
| 202 | +env: createNestedGitEnv(), |
| 203 | +}); |
| 204 | + |
| 205 | +expect(result.status).toBe(1); |
| 206 | +expect(result.stdout).toBe(""); |
| 207 | +expect(result.stderr.trim()).toBe("Unknown option: --jsno"); |
| 208 | +expect(result.stderr).not.toContain("\n at "); |
| 209 | +}); |
| 210 | + |
| 211 | +it("rejects unknown changed check options before treating them as paths", () => { |
| 212 | +const result = spawnSync(process.execPath, ["scripts/check-changed.mjs", "--dr-run"], { |
| 213 | +cwd: repoRoot, |
| 214 | +encoding: "utf8", |
| 215 | +env: { ...createNestedGitEnv(), OPENCLAW_TESTBOX: "1" }, |
| 216 | +}); |
| 217 | + |
| 218 | +expect(result.status).toBe(1); |
| 219 | +expect(result.stdout).toBe(""); |
| 220 | +expect(result.stderr.trim()).toBe("Unknown option: --dr-run"); |
| 221 | +expect(result.stderr).not.toContain("\n at "); |
| 222 | +expect(result.stderr).not.toContain("[check:changed]"); |
| 223 | +}); |
| 224 | + |
| 225 | +it("still accepts dash-prefixed explicit changed paths after the separator", () => { |
| 226 | +const result = spawnSync( |
| 227 | +process.execPath, |
| 228 | +["scripts/changed-lanes.mjs", "--json", "--", "--github-output"], |
| 229 | +{ |
| 230 | +cwd: repoRoot, |
| 231 | +encoding: "utf8", |
| 232 | +env: createNestedGitEnv(), |
| 233 | +}, |
| 234 | +); |
| 235 | + |
| 236 | +expect(result.status).toBe(0); |
| 237 | +expect(result.stderr).toBe(""); |
| 238 | +expect(parseChangedLaneOutput(result.stdout).paths).toEqual(["--github-output"]); |
| 239 | +}); |
| 240 | + |
| 241 | +it("keeps changed check option-shaped paths intact after the separator", () => { |
| 242 | +const args = buildChangedCheckCrabboxArgs(["--staged", "--", "--no-changes"], { |
| 243 | +cwd: repoRoot, |
| 244 | +}); |
| 245 | + |
| 246 | +expect(args.slice(args.indexOf("check:changed") + 1)).toEqual([ |
| 247 | +"--staged", |
| 248 | +"--", |
| 249 | +"--no-changes", |
| 250 | +]); |
| 251 | +}); |
| 252 | + |
198 | 253 | it("includes untracked worktree files in the default local diff", () => { |
199 | 254 | const dir = makeTempRepoRoot(tempDirs, "openclaw-changed-lanes-"); |
200 | 255 | git(dir, ["init", "-q", "--initial-branch=main"]); |
|