diff options
| author | Jesse Vincent <jesse@fsck.com> | 2025-11-28 22:21:24 -0800 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2025-12-17 16:44:50 -0800 |
| commit | 06310d6f5f960f28f8eec1d8117c0739a42e2163 (patch) | |
| tree | c9f2b35d349c881450f0e4ab0b5c7bc12d332eae /tests/claude-code | |
| parent | dc11a093c326d947f9ac8e416f1cd4b17887bb9a (diff) | |
Fix tests to use --allowed-tools flag
Claude Code headless mode requires --allowed-tools flag to actually
execute tool calls. Without it, Claude only responds as if it's doing
things but doesn't actually use tools.
Changes:
- Updated run_claude helper to accept allowed_tools parameter
- Updated integration test to use --allowed-tools=all
- This enables actual tool execution (Write, Task, Bash, etc.)
Now the integration test should actually execute the workflow instead
of just talking about it.
Diffstat (limited to 'tests/claude-code')
| -rwxr-xr-x | tests/claude-code/test-helpers.sh | 11 | ||||
| -rwxr-xr-x | tests/claude-code/test-subagent-driven-development-integration.sh | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/claude-code/test-helpers.sh b/tests/claude-code/test-helpers.sh index 242b16b..16518fd 100755 --- a/tests/claude-code/test-helpers.sh +++ b/tests/claude-code/test-helpers.sh @@ -2,14 +2,21 @@ # Helper functions for Claude Code skill tests # Run Claude Code with a prompt and capture output -# Usage: run_claude "prompt text" [timeout_seconds] +# Usage: run_claude "prompt text" [timeout_seconds] [allowed_tools] run_claude() { local prompt="$1" local timeout="${2:-60}" + local allowed_tools="${3:-}" local output_file=$(mktemp) + # Build command + local cmd="claude -p \"$prompt\"" + if [ -n "$allowed_tools" ]; then + cmd="$cmd --allowed-tools=$allowed_tools" + fi + # Run Claude in headless mode with timeout - if timeout "$timeout" claude -p "$prompt" > "$output_file" 2>&1; then + if timeout "$timeout" bash -c "$cmd" > "$output_file" 2>&1; then cat "$output_file" rm -f "$output_file" return 0 diff --git a/tests/claude-code/test-subagent-driven-development-integration.sh b/tests/claude-code/test-subagent-driven-development-integration.sh index b120da8..a4097a0 100755 --- a/tests/claude-code/test-subagent-driven-development-integration.sh +++ b/tests/claude-code/test-subagent-driven-development-integration.sh @@ -134,8 +134,9 @@ Begin now. Execute the plan. EOF # Note: We use a longer timeout since this is integration testing +# Use --allowed-tools to enable tool usage in headless mode PROMPT=$(cat "$TEST_PROJECT/prompt.txt") -timeout 1800 claude -p "$PROMPT" > "$OUTPUT_FILE" 2>&1 || { +timeout 1800 claude -p "$PROMPT" --allowed-tools=all > "$OUTPUT_FILE" 2>&1 || { echo "EXECUTION FAILED" cat "$OUTPUT_FILE" exit 1 |
