Skip to content

Commit 3ef0572

Browse files
committed
test(nuxt): Wait for the dev port to be available
1 parent 2a2e8cb commit 3ef0572

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

dev-packages/e2e-tests/test-applications/nuxt-4/nuxt-start-dev-server.bash

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,23 @@ fi
4545

4646
echo "Starting nuxt dev with Sentry server config..."
4747

48-
# 4. Start the actual dev command which should be used for the tests
49-
NODE_OPTIONS='--import ./.nuxt/dev/sentry.server.config.mjs' nuxt dev
48+
# 4. Start the actual dev command in the background first
49+
NODE_OPTIONS='--import ./.nuxt/dev/sentry.server.config.mjs' nuxt dev &
50+
DEV_PID=$!
51+
52+
# 5. Wait for port 3030 to be ready before Playwright starts running tests
53+
echo "Waiting for port 3030 to be ready..."
54+
COUNTER=0
55+
while ! nc -z localhost 3030 2>/dev/null && [ $COUNTER -lt 60 ]; do
56+
sleep 0.5
57+
((COUNTER++))
58+
done
59+
60+
if nc -z localhost 3030 2>/dev/null; then
61+
echo "Port 3030 is ready!"
62+
else
63+
echo "WARNING: Port 3030 not ready after 30 seconds"
64+
fi
65+
66+
# 6. Keep the script running (wait for the background process)
67+
wait $DEV_PID

0 commit comments

Comments
 (0)