test(solid-start): prerendering - sync #5475 to solid #5627
main fromrefs/pull/5627/head·merged by birkskyum(GitHub profile, opens in a new tab) Showing 7 changed files with 71 additions and 5 deletions (loading 4).
⚠️ Potential issue | 🔴 Critical
🧩 Analysis chain
Review the dummy server lifecycle scripts for robustness.
Several potential concerns with the dummy server management:
- Cross-platform compatibility: The
&operator for background execution is POSIX-specific and won't work in Windows CMD (though it works in PowerShell and WSL). - No startup synchronization:
startDummyServeruses&to run in the background, but there's no mechanism to ensure the server is ready before subsequent commands execute. This could cause race conditions in the prerender build. - Silent failures: If the server fails to start, the error might not be visible due to background execution.
Verify that:
- The
global.setup.tsincludes retry logic or startup delays - The build process has appropriate error handling if the dummy server isn't available
- Tests are expected to run only on POSIX-compatible systems, or alternative solutions exist for Windows
Run this script to check if global.setup has synchronization logic:
🏁 Script executed:
#!/bin/bash
# Check for startup synchronization in global.setup.ts
fd -t f global.setup.ts e2e/solid-start/basic/tests/setup --exec cat {}
Length of output: 220
🏁 Script executed:
#!/bin/bash
# Check global.teardown.ts
fd -t f global.teardown.ts e2e/solid-start/basic/tests/setup --exec cat {}
Length of output: 221
🏁 Script executed:
#!/bin/bash
# Look for usage of dummy server scripts in build/CI context
rg -n "test:e2e:startDummyServer|test:e2e:stopDummyServer" e2e/solid-start/basic/ -A2 -B2
Length of output: 1236
🏁 Script executed:
#!/bin/bash
# Check if there's a prerender script that uses these dummy server commands
fd -t f package.json e2e/solid-start/basic --exec cat {}
Length of output: 1805
🌐 Web query:
@tanstack/router-e2e-utils e2eStartDummyServer
💡 Result:
Do you want usage/docs for e2eStartDummyServer, its source code, or help fixing an error when calling it?
---
🏁 Script executed:
```shell
#!/bin/bash
# Search for e2eStartDummyServer implementation or usage hints
rg -n "e2eStartDummyServer|e2eStopDummyServer" e2e/solid-start/basic/ -A3 -B1
Length of output: 1087
🏁 Script executed:
#!/bin/bash
# Check if build:prerender or tests have any startup wait/retry logic
rg -n "port.*\.txt|readiness|retry|sleep|wait" e2e/solid-start/basic/playwright.config.ts e2e/solid-start/basic/package.json
Length of output: 776
🏁 Script executed:
#!/bin/bash
# Look for CI/test setup scripts that might have additional context
fd -t f "\.yml|\.yaml|\.ts|\.js" e2e/solid-start/basic --path-separator=/ | grep -E "(vite\.config|playwright\.config|setup|ci)" --exec cat {}
Length of output: 117
---
🏁 Script executed:
```shell
#!/bin/bash
# View full playwright.config.ts to understand port detection and timing
cat e2e/solid-start/basic/playwright.config.ts
Length of output: 1965
🏁 Script executed:
#!/bin/bash
# Search for getDummyServerPort implementation and usage
rg -n "getDummyServerPort" e2e/solid-start/basic/ -A5 -B2
Length of output: 2785
🏁 Script executed:
#!/bin/bash
# Check if there's any documentation or comments about the & in startDummyServer
rg -n "startDummyServer|stopDummyServer" . -A2 -B2 --type ts --type json | head -50
Length of output: 2520
Fix the dummy server lifecycle scripts: the & operator prevents proper async synchronization.
The & at the end of test:e2e:startDummyServer creates a race condition with build:prerender:
Async/await ignored: Although
global.setup.tsproperly awaitse2eStartDummyServer(), the npm script exits immediately due to&, causing the shell to return before the server finishes initializing.Playwright webServer races: Playwright's
webServermonitors the shell process. When it exits (due to&), Playwright treats it as "server ready" and immediately runs the next&&command (build:prerender), even though the actual dummy server is still starting up in the background.Intermittent failures:
build:prerendermay fail or hang if it needs the dummy server to be fully ready before proceeding.Cross-platform issue: The
&operator is POSIX-specific and won't work in Windows CMD (though it works in PowerShell and WSL).
Solution: Remove the & operator and let the npm script complete naturally. The await inside global.setup.ts will properly block until the server is ready:
"test:e2e:startDummyServer": "node -e 'import(\"./tests/setup/global.setup.ts\").then(m => m.default())'",
🤖 Prompt for AI Agents
In e2e/solid-start/basic/package.json around lines 14-15, the
test:e2e:startDummyServer script uses a trailing "&" which backgrounds the
process and breaks async synchronization; remove the "&" so the script runs
foreground and the awaited startup in tests/setup/global.setup.ts can complete
before subsequent steps (i.e., change the script to run the node import command
without the "&"), ensuring cross-platform compatibility by not backgrounding the
process.
✅ Addressed in commits 55393f1 to 7ea0729