Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,23 @@ fi

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

# 4. Start the actual dev command which should be used for the tests
NODE_OPTIONS='--import ./.nuxt/dev/sentry.server.config.mjs' nuxt dev
# 4. Start the actual dev command in the background first
NODE_OPTIONS='--import ./.nuxt/dev/sentry.server.config.mjs' nuxt dev &
DEV_PID=$!

# 5. Wait for port 3030 to be ready before Playwright starts running tests
echo "Waiting for port 3030 to be ready..."
COUNTER=0
while ! nc -z localhost 3030 2>/dev/null && [ $COUNTER -lt 60 ]; do
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The script uses nc -z to check for an open port, but nc is not installed in the CI environment (ubuntu-24.04), causing the check to fail silently and wait for a full 30-second timeout.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The bash script nuxt-start-dev-server.bash uses nc -z within a while loop to check if the dev server port is available. However, the netcat (nc) utility is not installed by default on the CI runner's operating system, ubuntu-24.04. When nc is not found, the command fails with exit code 127. The loop condition ! nc -z ... evaluates this failure as true, causing the loop to always run for its full 30-second duration, regardless of the server's actual status. This introduces a mandatory 30-second delay and can lead to flaky test failures if tests begin before the server is truly ready.

💡 Suggested Fix

Replace the nc -z command with a more reliable method that does not depend on a non-default utility. For instance, the script already uses lsof -i :$PORT in other places, which is more likely to be available. Alternatively, add a step to the CI workflow to install netcat (sudo apt-get install -y netcat-openbsd) before the script is run.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: dev-packages/e2e-tests/test-applications/nuxt-4/nuxt-start-dev-server.bash#L55

Potential issue: The bash script `nuxt-start-dev-server.bash` uses `nc -z` within a
`while` loop to check if the dev server port is available. However, the `netcat` (`nc`)
utility is not installed by default on the CI runner's operating system, `ubuntu-24.04`.
When `nc` is not found, the command fails with exit code 127. The loop condition `! nc
-z ...` evaluates this failure as `true`, causing the loop to always run for its full
30-second duration, regardless of the server's actual status. This introduces a
mandatory 30-second delay and can lead to flaky test failures if tests begin before the
server is truly ready.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 8338389

sleep 0.5
((COUNTER++))
done

if nc -z localhost 3030 2>/dev/null; then
echo "Port 3030 is ready!"
else
echo "WARNING: Port 3030 not ready after 30 seconds"
fi

# 6. Keep the script running (wait for the background process)
wait $DEV_PID
Loading