test: add run-tests.sh, fix stale tests for marketplace model
- Add tests/run-tests.sh: discovers and runs all test-*.sh (including plugin subdirs) and the bats suite; replaces per-script pre-push calls - Add tests/run-tests.bats: TDD coverage for run-tests.sh behaviours - Update setup-hooks.sh: pre-push block now calls run-tests.sh - Fix test-install.sh: remove provider adapter symlink tests (adapter removed in marketplace migration), guard skills loops on dir existence - Fix test-instructions-and-docs.sh: content index checks now point to core/AGENTS.md (where it lives), remove ard/bug dir assertions - Fix test-setup-hooks.sh: assert pre-push hook calls run-tests.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
57
tests/run-tests.sh
Executable file
57
tests/run-tests.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run all test-*.sh files in the repo (including plugins) and the bats suite.
|
||||
# Usage: bash tests/run-tests.sh [--bats-only]
|
||||
#
|
||||
# TEST_DIR — override root to search for test-*.sh (default: REPO_ROOT); used by tests.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BATS="$REPO_ROOT/tests/run-bats.sh"
|
||||
BATS_ONLY=false
|
||||
[[ "${1:-}" == "--bats-only" ]] && BATS_ONLY=true
|
||||
|
||||
SEARCH_ROOT="${TEST_DIR:-$REPO_ROOT}"
|
||||
|
||||
FAILED=()
|
||||
PASSED=0
|
||||
|
||||
run_bats() {
|
||||
if [[ -x "$BATS" ]]; then
|
||||
echo "=== bats ==="
|
||||
bash "$BATS"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if $BATS_ONLY; then
|
||||
run_bats
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_bats
|
||||
|
||||
mapfile -t SCRIPTS < <(
|
||||
find "$SEARCH_ROOT" -name "test-*.sh" \
|
||||
-not -path "*/.git/*" \
|
||||
| sort
|
||||
)
|
||||
|
||||
for script in "${SCRIPTS[@]}"; do
|
||||
rel="${script#"$SEARCH_ROOT/"}"
|
||||
echo "=== $rel ==="
|
||||
if bash "$script"; then
|
||||
PASSED=$((PASSED + 1))
|
||||
else
|
||||
FAILED+=("$rel")
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "=== Summary: $PASSED passed, ${#FAILED[@]} failed ==="
|
||||
if [[ ${#FAILED[@]} -gt 0 ]]; then
|
||||
echo "Failed scripts:"
|
||||
for s in "${FAILED[@]}"; do
|
||||
echo " $s"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user