Skip to content

Commit c18def4

Browse files
fix: add bash runner auto-detect and skip CMD validation when TEST_DIR set (2b52-b2e8) (merge worktree-20260324-091358)
2 parents 5c0024e + 9e7cbf6 commit c18def4

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

plugins/dso/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dso",
3-
"version": "0.25.15",
3+
"version": "0.25.16",
44
"description": "Workflow infrastructure plugin for Claude Code projects",
55
"commands": "./commands/",
66
"skills": "./skills/",

plugins/dso/scripts/test-batched.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ for arg in "$@"; do
191191
done
192192

193193
# ── Validate required argument ─────────────────────────────────────────────────
194-
# CMD is required for generic runner; node and pytest runners can operate without it.
195-
if [ -z "$CMD" ] && [ "$RUNNER" != "node" ] && [ "$RUNNER" != "pytest" ] && [ "$RUNNER" != "bash" ]; then
194+
# CMD is required for generic runner; named runners (node, pytest, bash) can
195+
# operate without it. When TEST_DIR is set and RUNNER is empty (auto-detect mode),
196+
# skip CMD validation — a runner driver may claim the work before the generic
197+
# fallback is reached.
198+
if [ -z "$CMD" ] && [ "$RUNNER" != "node" ] && [ "$RUNNER" != "pytest" ] && [ "$RUNNER" != "bash" ] && [ -z "$TEST_DIR" ]; then
196199
echo "ERROR: Missing required argument: <command>" >&2
197200
echo ""
198201
sed -n '2,/^$/s/^# \{0,1\}//p' "$0" | head -60 >&2

tests/scripts/test-test-batched.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,5 +1037,46 @@ assert_ne "test_bash_runner_records_failures: exits non-zero" "0" "$bash_fail_ex
10371037
rm -rf "$TMPDIR_BASH_FAIL"
10381038
assert_pass_if_clean "test_bash_runner_records_failures"
10391039

1040+
# ── test_bash_auto_detected_when_test_scripts_exist ─────────────────────────
1041+
# Auto-detect: when test-*.sh files exist under --test-dir and no explicit
1042+
# --runner flag is given, the bash driver should activate automatically
1043+
# (after node and pytest auto-detect fail to claim the runner).
1044+
echo ""
1045+
echo "--- test_bash_auto_detected_when_test_scripts_exist ---"
1046+
_snapshot_fail
1047+
TMPDIR_BASH_AUTO="$(mktemp -d)"
1048+
BASH_AUTO_STATE="$TMPDIR_BASH_AUTO/state.json"
1049+
1050+
cat > "$TMPDIR_BASH_AUTO/test-auto-one.sh" << 'SHEOF'
1051+
#!/usr/bin/env bash
1052+
exit 0
1053+
SHEOF
1054+
chmod +x "$TMPDIR_BASH_AUTO/test-auto-one.sh"
1055+
cat > "$TMPDIR_BASH_AUTO/test-auto-two.sh" << 'SHEOF'
1056+
#!/usr/bin/env bash
1057+
exit 0
1058+
SHEOF
1059+
chmod +x "$TMPDIR_BASH_AUTO/test-auto-two.sh"
1060+
1061+
bash_auto_out=""
1062+
bash_auto_exit=0
1063+
bash_auto_out=$(TEST_BATCHED_STATE_FILE="$BASH_AUTO_STATE" \
1064+
bash "$SCRIPT" --test-dir="$TMPDIR_BASH_AUTO" --timeout=30 2>&1) \
1065+
|| bash_auto_exit=$?
1066+
# Should auto-detect bash runner and show both scripts
1067+
auto_one=0
1068+
auto_two=0
1069+
echo "$bash_auto_out" | grep -q "test-auto-one.sh" && auto_one=1
1070+
echo "$bash_auto_out" | grep -q "test-auto-two.sh" && auto_two=1
1071+
assert_eq "test_bash_auto_detected_when_test_scripts_exist: found test-auto-one.sh" "1" "$auto_one"
1072+
assert_eq "test_bash_auto_detected_when_test_scripts_exist: found test-auto-two.sh" "1" "$auto_two"
1073+
# Should show 2/2 progress (not 1/1 generic fallback)
1074+
auto_progress=0
1075+
echo "$bash_auto_out" | grep -q "2/2" && auto_progress=1
1076+
assert_eq "test_bash_auto_detected_when_test_scripts_exist: shows 2/2 progress" "1" "$auto_progress"
1077+
assert_eq "test_bash_auto_detected_when_test_scripts_exist: exits 0" "0" "$bash_auto_exit"
1078+
rm -rf "$TMPDIR_BASH_AUTO"
1079+
assert_pass_if_clean "test_bash_auto_detected_when_test_scripts_exist"
1080+
10401081
print_summary
10411082

0 commit comments

Comments
 (0)