Skip to content

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Jan 8, 2026

closes #18728
closes JS-1422

Not sure if this is the correct way of doing that, but it seems the tests were failing for Nuxt 4 canary, but only the dev ones. Locally at least with that fix it wasn't flaky anymore.

@linear
Copy link

linear bot commented Jan 8, 2026

@JPeer264 JPeer264 requested review from logaretm and s1gr1d January 8, 2026 13:10
Copy link
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

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

I don't think that this will fix that - I'm also working on this right now (I introduced this problem 🙈 ).

I was under the assumption that playwright will wait for the port 3030 to start testing. But it seems like playwright already starts testing when only the temporary port 3035 is available.

# 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

@s1gr1d
Copy link
Member

s1gr1d commented Jan 8, 2026

I think this PR can be closed in favor of this one: #18737

@JPeer264 JPeer264 closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nuxt-4 (canary) Test Failed

3 participants