diff --git a/README.md b/README.md index 6ad857e..9aa988b 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,3 @@ scripts/e2e.sh ``` And to clean up the logs & database files, run `scripts/clean-up.sh` -``` diff --git a/frontend/package.json b/frontend/package.json index 24c4638..cb0f45f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,7 +16,7 @@ "build": "npm run build --workspaces", "dev": "concurrently --kill-others \"npm run dev -w sync-client\" \"npm run dev -w obsidian-plugin\"", "test": "npm run test --workspaces", - "lint": "eslint --fix sync-client obsidian-plugin test-client && prettier --write \"**/*.(ts|scss|json|html)\"", + "lint": "eslint --fix sync-client obsidian-plugin test-client && prettier --write \"**/*.ts\"", "update": "ncu -u -ws" }, "devDependencies": { @@ -27,4 +27,4 @@ "prettier": "^3.5.3", "typescript-eslint": "8.26.1" } -} +} \ No newline at end of file diff --git a/scripts/e2e.sh b/scripts/e2e.sh index fa06d82..f969f29 100755 --- a/scripts/e2e.sh +++ b/scripts/e2e.sh @@ -17,6 +17,8 @@ mkdir -p logs cd frontend npm run build +./scripts/wait-for-server.sh + pids=() for i in $(seq 1 $process_count); do node test-client/dist/cli.js > "../logs/log_${i}.log" 2>&1 & diff --git a/scripts/wait-for-server.sh b/scripts/wait-for-server.sh new file mode 100755 index 0000000..fa7f02b --- /dev/null +++ b/scripts/wait-for-server.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +SERVER_URL="http://localhost:3000" +MAX_RETRIES=30 +RETRY_INTERVAL_IN_SECONDS=5 + +echo "Waiting for $SERVER_URL to become available..." +count=0 +while [ $count -lt $MAX_RETRIES ]; do + if curl -s -f -o /dev/null $SERVER_URL; then + echo "$SERVER_URL is now available!" + break + fi + echo "Attempt $(($count+1))/$MAX_RETRIES: $SERVER_URL not available yet, retrying in ${RETRY_INTERVAL_IN_SECONDS}s..." + sleep $RETRY_INTERVAL_IN_SECONDS + count=$(($count+1)) +done + +if [ $count -eq $MAX_RETRIES ]; then + echo "Error: $SERVER_URL did not become available after $MAX_RETRIES attempts." + exit 1 +fi