#!/usr/bin/env bash # Unified test runner for replica-omnisciente monorepo # Usage: ./scripts/test-all.sh [--vscode] [--backend] [--frontend] [--quick] set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" PASS=0 FAIL=0 SKIP=0 run_suite() { local name="$1" local dir="$2" local cmd="$3" echo "" echo "══════════════════════════════════════" echo " $name" echo "══════════════════════════════════════" if (cd "$dir" && eval "$cmd"); then echo " ✓ $name PASSED" PASS=$((PASS + 1)) else echo " ✗ $name FAILED" FAIL=$((FAIL + 1)) fi } # --- aurelio-vscode unit tests (mocha) --- if [[ "${1:-}" != "--backend" && "${1:-}" != "--frontend" ]]; then if [ -d "$ROOT/extensions/aurelio-vscode/node_modules/mocha" ]; then run_suite "aurelio-vscode (unit)" "$ROOT/extensions/aurelio-vscode" \ "TS_NODE_PROJECT=./tsconfig.unit-test.json npx mocha" else echo "SKIP aurelio-vscode — run npm install first" SKIP=$((SKIP + 1)) fi fi # --- aurelio-backend tests (node --test) --- if [[ "${1:-}" != "--vscode" && "${1:-}" != "--frontend" ]]; then if [ -d "$ROOT/aurelio-theia/aurelio-backend/node_modules" ]; then run_suite "aurelio-backend" "$ROOT/aurelio-theia/aurelio-backend" \ "npx tsc -p tsconfig.json && npm test" else echo "SKIP aurelio-backend — run npm install --ignore-scripts first" SKIP=$((SKIP + 1)) fi fi # --- dirac tests (mocha) --- if [[ "${1:-}" == "--quick" || "${1:-}" == "" ]]; then if [ -d "$ROOT/dirac/node_modules/mocha" ]; then run_suite "dirac (unit)" "$ROOT/dirac" \ "cross-env TS_NODE_PROJECT=./tsconfig.unit-test.json npx mocha" else echo "SKIP dirac — run npm install first" SKIP=$((SKIP + 1)) fi fi echo "" echo "══════════════════════════════════════" echo " RESULTS: $PASS passed, $FAIL failed, $SKIP skipped" echo "══════════════════════════════════════" exit $FAIL