@@ -1037,5 +1037,46 @@ assert_ne "test_bash_runner_records_failures: exits non-zero" "0" "$bash_fail_ex
10371037rm -rf " $TMPDIR_BASH_FAIL "
10381038assert_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+
10401081print_summary
10411082
0 commit comments