Files
Christian Nennemann 6a49c21bbe test: add bats test suite for lib/ helper scripts
110 tests across 10 test files covering all lib/ scripts:
- archeflow-event.sh: JSONL format, seq numbering, parent fields, validation
- archeflow-memory.sh: add/list/decay/forget/inject/extract commands
- archeflow-git.sh: branch creation, commit format, merge strategies, safety
- archeflow-report.sh: markdown output, summary mode, in-progress handling
- archeflow-progress.sh: progress.md generation, JSON mode, error handling
- archeflow-score.sh: archetype scoring, effectiveness report, validation
- archeflow-dag.sh: DAG rendering, color flags, tree structure
- archeflow-rollback.sh: arg parsing, phase validation, mutual exclusivity
- archeflow-init.sh: template listing, clone from project, arg validation
- archeflow-review.sh: diff modes, stats, branch/commit range review

Includes test_helper.bash (shared setup/teardown with temp git repos)
and scripts/run-tests.sh runner.
2026-04-06 21:20:05 +02:00

35 lines
911 B
Bash
Executable File

#!/usr/bin/env bash
# run-tests.sh — Run all ArcheFlow bats tests.
#
# Usage: ./scripts/run-tests.sh [bats-args...]
# Examples:
# ./scripts/run-tests.sh # Run all tests
# ./scripts/run-tests.sh --filter "event" # Run only event tests
# ./scripts/run-tests.sh -t # TAP output
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
TESTS_DIR="$PROJECT_DIR/tests"
# Find bats binary
BATS="${BATS:-}"
if [[ -z "$BATS" ]]; then
if command -v bats &>/dev/null; then
BATS="bats"
elif [[ -x "$HOME/.local/bin/bats" ]]; then
BATS="$HOME/.local/bin/bats"
else
echo "ERROR: bats not found. Install bats-core or set BATS env var." >&2
exit 1
fi
fi
echo "Running ArcheFlow tests..."
echo " bats: $($BATS --version)"
echo " tests: $TESTS_DIR"
echo ""
exec "$BATS" "$@" "$TESTS_DIR"/*.bats