#!/usr/bin/env bash # Teljeskörű pre-deploy tesztkészlet — minden deploy előtt futtatandó. # Összefogja a proto (weboldal) és a gyökér (CMS/infra) lokális tesztjeit; # csoportonkénti PASS/FAIL összegzéssel, hiba esetén nem-nulla exit kód. # # Használat: scripts/pre-deploy-tests.sh # A deploy_to_stage_on_local.sh 1. lépésként futtatja. set -uo pipefail readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" FAILED=() run() { local name="$1"; shift printf '\n── %s\n' "$name" if "$@"; then printf '✅ %s\n' "$name" else printf '❌ %s\n' "$name" FAILED+=("$name") fi } # ── Weboldal (proto) ───────────────────────────────────────────────────────── run "proto: unit tesztek (jest, 60+)" bash -c "cd '${ROOT}/proto' && npm test --silent" run "proto: típusellenőrzés (tsc --noEmit)" bash -c "cd '${ROOT}/proto' && npx tsc --noEmit" run "proto: lint (eslint)" bash -c "cd '${ROOT}/proto' && npm run lint" # ── Tartalom ───────────────────────────────────────────────────────────────── run "content: séma-validáció (minden JSON)" node "${ROOT}/scripts/test-content-schema.js" # ── CMS (content-editor) ───────────────────────────────────────────────────── run "cms: security guard (auth, CSRF, XFF)" node "${ROOT}/scripts/test-content-editor-security.js" run "cms: serializer regresszió (collect/reindex)" node "${ROOT}/scripts/test-content-editor-serializer.js" run "cms: atomikus mentés + backup" node "${ROOT}/scripts/test-content-editor-save.js" run "cms: optimista zárolás (409, hash-frissítés)" node "${ROOT}/scripts/test-content-editor-conflict.js" run "cms: verziók panel (diff, restore)" node "${ROOT}/scripts/test-content-editor-versions.js" run "cms: logó feltöltés (PNG, backup, audit)" node "${ROOT}/scripts/test-content-editor-logo.js" run "cms: login flow (session, Safari-scenariok)" node "${ROOT}/scripts/test-content-editor-login.js" run "cms: logout + rate-limit" node "${ROOT}/scripts/test-content-editor-logout.js" run "cms: guide endpoint + renderer" node "${ROOT}/scripts/test-content-editor-guide.js" run "cms: alsó sáv layout guard" node "${ROOT}/scripts/test-content-editor-bottombar.js" run "cms: publish parancs + integráció" node "${ROOT}/scripts/test-cms-publish.js" # ── Infra ──────────────────────────────────────────────────────────────────── run "plane: sync unit tesztek" node --test "${ROOT}/scripts/plane/plane-sync.test.js" # ── Összegzés ──────────────────────────────────────────────────────────────── printf '\n────────────────────────────────────────\n' if [ "${#FAILED[@]}" -gt 0 ]; then printf '❌ %d tesztcsoport HIBÁS: %s\n' "${#FAILED[@]}" "${FAILED[*]}" exit 1 fi printf '✅ Minden pre-deploy teszt zöld.\n'