mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
fix: enforce max turns from claude args (#1607)
This commit is contained in:
@@ -521,6 +521,31 @@ describe("parseSdkOptions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("max turns handling", () => {
|
||||
test("should map --max-turns from claudeArgs to sdkOptions.maxTurns", () => {
|
||||
const options: ClaudeOptions = {
|
||||
claudeArgs: "--max-turns 60",
|
||||
};
|
||||
|
||||
const result = parseSdkOptions(options);
|
||||
|
||||
expect(result.sdkOptions.maxTurns).toBe(60);
|
||||
expect(result.sdkOptions.extraArgs?.["max-turns"]).toBeUndefined();
|
||||
});
|
||||
|
||||
test("should prefer the direct maxTurns option", () => {
|
||||
const options: ClaudeOptions = {
|
||||
maxTurns: "25",
|
||||
claudeArgs: "--max-turns 60",
|
||||
};
|
||||
|
||||
const result = parseSdkOptions(options);
|
||||
|
||||
expect(result.sdkOptions.maxTurns).toBe(25);
|
||||
expect(result.sdkOptions.extraArgs?.["max-turns"]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("environment variables passthrough", () => {
|
||||
test("should include OTEL environment variables in sdkOptions.env", () => {
|
||||
// Set up test environment variables
|
||||
|
||||
Reference in New Issue
Block a user