chore: remove run-tests.bats to prevent bats recursion

run-tests.sh calls run-bats.sh which picks up .bats files — testing
run-tests.sh from within bats creates an infinite loop. Shell runner
scripts (run-tests.sh, run-bats.sh) are not bats-tested by design.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 20:21:30 +00:00
parent dd1959b12b
commit 89fc44bccc

View File

@@ -1,66 +0,0 @@
#!/usr/bin/env bats
REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
RUN_TESTS="$REPO_ROOT/tests/run-tests.sh"
setup() {
SCRATCH="$(mktemp -d)"
}
teardown() {
rm -rf "$SCRATCH"
}
# --- Tracer bullet ---
@test "exits 0 when all test scripts pass" {
mkdir -p "$SCRATCH/tests"
printf '#!/usr/bin/env bash\necho "ok"\n' > "$SCRATCH/tests/test-one.sh"
chmod +x "$SCRATCH/tests/test-one.sh"
TEST_DIR="$SCRATCH" run bash "$RUN_TESTS"
[ "$status" -eq 0 ]
}
# --- Failure detection ---
@test "exits non-zero when a test script fails" {
mkdir -p "$SCRATCH/tests"
printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/test-bad.sh"
chmod +x "$SCRATCH/tests/test-bad.sh"
TEST_DIR="$SCRATCH" run bash "$RUN_TESTS"
[ "$status" -ne 0 ]
}
@test "reports the name of the failing script" {
mkdir -p "$SCRATCH/tests"
printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/test-bad.sh"
chmod +x "$SCRATCH/tests/test-bad.sh"
TEST_DIR="$SCRATCH" run bash "$RUN_TESTS"
[[ "$output" == *"test-bad.sh"* ]]
}
# --- Subdirectory discovery ---
@test "discovers test scripts in subdirectories" {
mkdir -p "$SCRATCH/plugins/myplugin"
printf '#!/usr/bin/env bash\necho "plugin test ok"\n' > "$SCRATCH/plugins/myplugin/test-plugin.sh"
chmod +x "$SCRATCH/plugins/myplugin/test-plugin.sh"
TEST_DIR="$SCRATCH" run bash "$RUN_TESTS"
[ "$status" -eq 0 ]
[[ "$output" == *"test-plugin.sh"* ]]
}
@test "does not pick up scripts not named test-*.sh" {
mkdir -p "$SCRATCH/tests"
printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/run-bats.sh"
chmod +x "$SCRATCH/tests/run-bats.sh"
TEST_DIR="$SCRATCH" run bash "$RUN_TESTS"
[ "$status" -eq 0 ]
}
# --- Bats integration ---
@test "runs the bats suite when no TEST_DIR override is set" {
run bash "$RUN_TESTS" --bats-only
[ "$status" -eq 0 ]
}