This commit is contained in:
MartinBraquet
2026-02-17 15:54:58 +01:00
parent dd049dfb88
commit c47e693e69
5 changed files with 103 additions and 18 deletions

View File

@@ -17,8 +17,7 @@ check_services() {
if ! supabase status --output json | jq -r '.API_URL'; then
print_error "Supabase is not running. Starting..."
supabase start
supabase db reset
yarn test:db:reset
missing=1
fi

View File

@@ -59,12 +59,8 @@ print_status "Killing any stale processes..."
supabase stop --no-backup 2>/dev/null || true
sleep 2 # Give ports time to free up
# Start Supabase (includes Postgres, Auth, Storage, etc.)
supabase start
# Apply migrations (if using Supabase migrations)
./scripts/combine-migrations.sh
supabase db reset
# Start Supabase (includes Postgres, Auth, Storage, etc.) and Apply migrations
yarn test:db:reset
# Get connection details
export NEXT_PUBLIC_SUPABASE_URL=$(supabase status --output json | jq -r '.API_URL')

View File

@@ -1,5 +1,7 @@
#!/bin/bash
cd "$(dirname "$0")"/..
# Run the web app locally in full isolation (database, storage and authentication all stored locally)
# What runs on each port?
# - 4000: Firebase emulator UI
@@ -17,7 +19,7 @@
# Clean ghost processes
kill_ghosts() {
for p in 3000 4000 4400 4500 8088; do
for p in 3000 4000 4400 4500 8088 9099 9199; do
pids=$(lsof -ti :$p 2>/dev/null)
if [ -n "$pids" ]; then
kill $pids || true
@@ -30,22 +32,35 @@ set -euo pipefail
# Function to clean up background processes
cleanup() {
echo "Stopping background processes..."
print_status "Cleaning up..."
# Stop Firebase emulators
./scripts/firebase_stop.sh
# Kill all background processes
for pid in "${PIDS[@]:-}"; do
if kill -0 "$pid" 2>/dev/null; then
kill "$pid" || true
kill "$pid" 2>/dev/null || true
wait "$pid" 2>/dev/null || true
echo "Killed PID $pid"
fi
done
kill_ghosts
# Stop Docker containers
if [ "${SKIP_DB_CLEANUP:-}" != "true" ]; then
print_status "Stopping test database..."
docker compose -f scripts/docker-compose.test.yml down -v
fi
sleep 2
print_status "Cleanup complete"
}
# Trap EXIT, INT, TERM to run cleanup automatically
trap cleanup EXIT INT TERM
cd "$(dirname "$0")"/..
export $(cat .env.test | grep -v '^#' | xargs)
# Ensure Supabase local stack is running; if not, reset/start it