- Add bats-core, bats-support, bats-assert as git submodules under tests/ - Add tests/run-bats.sh — discovers and runs all *.bats files in the repo - 17 tests for skill-audit/scripts/validate.sh: valid skill, --help, optional dirs, backtick-quoted placeholder exclusion, boundary checks (500 lines / 1024 chars), and failure cases (missing SKILL.md, name mismatch, placeholders, non-executable scripts, interactive prompts, invalid name formats, no args) - 16 tests for skill-write/scripts/new-skill.sh: scaffold structure, name substitution, numbers in name, /skill-audit reference in next-steps, and failure cases (uppercase, consecutive/leading/trailing hyphens, missing dest, existing target, no args) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
650 B
Bash
Executable File
28 lines
650 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run all bats test files in the repo.
|
|
# Usage: bash tests/run-bats.sh
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
BATS="$REPO_ROOT/tests/bats/bin/bats"
|
|
|
|
if [[ ! -x "$BATS" ]]; then
|
|
echo "Error: bats not found at $BATS" >&2
|
|
echo " Run: git submodule update --init --recursive" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mapfile -t TEST_FILES < <(
|
|
find "$REPO_ROOT" -name "*.bats" \
|
|
-not -path "*/tests/bats/*" \
|
|
-not -path "*/test_helper/*" \
|
|
| sort
|
|
)
|
|
|
|
if [[ ${#TEST_FILES[@]} -eq 0 ]]; then
|
|
echo "No .bats test files found." >&2
|
|
exit 0
|
|
fi
|
|
|
|
"$BATS" "${TEST_FILES[@]}"
|