test(solid-start): prerendering - sync #5475 to solid #5627
main fromrefs/pull/5627/head·merged by birkskyum(GitHub profile, opens in a new tab) Blocked by
Related to
Summary by CodeRabbit#
New Features
- Added prerendering support for Solid Start projects, enabling static generation of routes.
Tests
- Added end-to-end prerender test suite validating generated static routes and content.
- Extended the test pipeline to run prerender mode and added lifecycle scripts to start/stop the test server and run prerender checks.
- 1
View your CI Pipeline Execution ↗ for commit d7c32dbafea44e5fcc3a869874e7f6ca1d709bea
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 5m 28s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 16s View ↗
☁️ Nx Cloud last updated this comment at
2025-11-03 03:02:16UTCMore templates
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-example-basic-supabase
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5627@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5627@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5627@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5627@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5627@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5627@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5627@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5627@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5627@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5627@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5627@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5627@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5627@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5627@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5627@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5627@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5627@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5627@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5627@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5627@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5627@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5627@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5627@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5627@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5627@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5627@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5627@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5627@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5627@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5627@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5627@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5627@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5627@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5627@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5627commit:
d7c32dbbirkskyum(GitHub profile, opens in a new tab) changed the title
Actionable comments posted: 3
🧹 Nitpick comments (2)
e2e/solid-start/basic/tests/prerendering.spec.ts (2)
10-31: Consider adding a dist directory existence check.The test assumes
dist/clientexists without verifying. If the build fails or the test runs from an unexpected location, the error messages could be confusing.Apply this diff to add an initial check:
test('should automatically discover and prerender static routes', () => { // Check that static routes were automatically discovered and prerendered const distDir = join(process.cwd(), 'dist', 'client') + expect(existsSync(distDir)).toBe(true) // These static routes should be automatically discovered and prerendered expect(existsSync(join(distDir, 'index.html'))).toBe(true)
34-52: Consider parameterizing the content verification tests.The two tests have identical structure and could be combined using test.each to reduce duplication and make it easier to add more content checks.
Example refactor:
test.describe('Static Files Verification', () => { test.each([ { route: 'posts', expectedContent: 'Select a post.' }, { route: 'users', expectedContent: 'Select a user.' }, ])('should contain prerendered content in $route.html', ({ route, expectedContent }) => { const distDir = join(process.cwd(), 'dist', 'client') const htmlPath = join(distDir, route, 'index.html') expect(existsSync(htmlPath)).toBe(true) const html = readFileSync(htmlPath, 'utf-8') expect(html).toContain(expectedContent) }) })📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 6e557f9d40d5c6ad70cf6b54427c33bf59f0550d and 7b61b60ae143bdc710eefe4b31008e5a53bbbb59.
📒 Files selected for processing (6)
e2e/solid-start/basic/package.json(1 hunks)e2e/solid-start/basic/playwright.config.ts(4 hunks)e2e/solid-start/basic/tests/prerendering.spec.ts(1 hunks)e2e/solid-start/basic/tests/search-params.spec.ts(4 hunks)e2e/solid-start/basic/tests/utils/isPrerender.ts(1 hunks)e2e/solid-start/basic/vite.config.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/solid-start/basic/tests/utils/isPrerender.tse2e/solid-start/basic/vite.config.tse2e/solid-start/basic/tests/search-params.spec.tse2e/solid-start/basic/playwright.config.tse2e/solid-start/basic/tests/prerendering.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/solid-start/basic/tests/utils/isPrerender.tse2e/solid-start/basic/package.jsone2e/solid-start/basic/vite.config.tse2e/solid-start/basic/tests/search-params.spec.tse2e/solid-start/basic/playwright.config.tse2e/solid-start/basic/tests/prerendering.spec.ts
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
e2e/solid-start/basic/package.json
🧬 Code graph analysis (4)
e2e/solid-start/basic/vite.config.ts (1)
e2e/solid-start/basic/tests/utils/isPrerender.ts (1)
isPrerender(1-1)
e2e/solid-start/basic/tests/search-params.spec.ts (1)
e2e/solid-start/basic/tests/utils/isPrerender.ts (1)
isPrerender(1-1)
e2e/solid-start/basic/playwright.config.ts (2)
e2e/solid-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/solid-start/basic/tests/utils/isPrerender.ts (1)
isPrerender(1-1)
e2e/solid-start/basic/tests/prerendering.spec.ts (1)
e2e/solid-start/basic/tests/utils/isPrerender.ts (1)
isPrerender(1-1)
🔇 Additional comments (11)
e2e/solid-start/basic/vite.config.ts (2)
6-6: LGTM!The import follows the established pattern of the
isSpaModeutility.
15-26: Clarify the filter logic concern — one example is invalid, and the suggested fix has issues.The substring matching concern is partially valid but contains errors:
- Valid: A path like
/redirect-mewould incorrectly match and be filtered out (false positive) - Invalid: A path
/not-found/something/elsewould NOT match/not-found/via-loader(that substring doesn't exist in the path)
Additionally, the first suggested fix is incorrect:
.includes(page.path)checks if the array contains the path as an element (exact matching), which is not the intended behavior.The
.startsWith()approach would be appropriate if you want prefix-based exclusion of all nested routes under/redirectand/not-found. However, you should verify whether the current substring-matching behavior is intentional given that the codebase has routes like/redirect/$target/via-beforeLoadthat would match the/redirectpattern regardless.e2e/solid-start/basic/tests/utils/isPrerender.ts (1)
1-1: LGTM!Clean utility following the established pattern of
isSpaMode.e2e/solid-start/basic/playwright.config.ts (3)
7-8: LGTM!The imports are correct, and the JSON import assertion syntax is appropriate.
28-28: LGTM!The console logging helps with debugging test execution modes.
46-46: LGTM!Using the
getCommand()helper improves code clarity.e2e/solid-start/basic/tests/search-params.spec.ts (2)
31-33: LGTM!The updated redirect logic correctly accounts for prerender mode. Prerendered pages are static, so server-side redirects don't occur at request time—they're handled during the build.
Also applies to: 56-58
69-69: LGTM!URL normalization by removing the unnecessary trailing slash before the query parameters improves consistency.
e2e/solid-start/basic/tests/prerendering.spec.ts (1)
1-8: LGTM!The imports are appropriate for filesystem-based prerender verification, and the conditional skip ensures tests only run in the correct mode.
e2e/solid-start/basic/package.json (2)
11-11: LGTM!The build script follows the established pattern and correctly sets the MODE environment variable.
18-19: LGTM!The test scripts properly integrate prerender mode into the e2e test workflow, and the sequential chaining with
&&ensures that failures in any mode stop the test run.@@ -8,5 +8,8 @@88 "dev:e2e": "vite dev",99 "build": "vite build && tsc --noEmit",1010 "build:spa": "MODE=spa vite build && tsc --noEmit",11+ "build:prerender": "MODE=prerender vite build && tsc --noEmit",1112 "start": "pnpx srvx --prod -s ../client dist/server/server.js",1213 "start:spa": "node server.js",14+ "test:e2e:startDummyServer": "node -e 'import(\"./tests/setup/global.setup.ts\").then(m => m.default())' &",15+ "test:e2e:stopDummyServer": "node -e 'import(\"./tests/setup/global.teardown.ts\").then(m => m.default())'",⚠️ 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 -B2Length 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 -B1Length 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.jsonLength 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.tsLength of output: 1965
🏁 Script executed:
#!/bin/bash # Search for getDummyServerPort implementation and usage rg -n "getDummyServerPort" e2e/solid-start/basic/ -A5 -B2Length 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 -50Length of output: 2520
Fix the dummy server lifecycle scripts: the & operator prevents proper async synchronization.
The
&at the end oftest:e2e:startDummyServercreates a race condition withbuild: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. Theawaitinsideglobal.setup.tswill 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
e2e/solid-start/basic/playwright.config.ts lines 20 to 26@@ -16,4 +17,10 @@1617 const baseURL = `http://localhost:${PORT}`1718 const spaModeCommand = `pnpm build:spa && pnpm start:spa`1819 const ssrModeCommand = `pnpm build && pnpm start`20+const prerenderModeCommand = `pnpm run test:e2e:startDummyServer && pnpm build:prerender && pnpm run test:e2e:stopDummyServer && pnpm start`192122+const getCommand = () => {23+ if (isSpaMode) return spaModeCommand24+ if (isPrerender) return prerenderModeCommand25+ return ssrModeCommand26+}⚠️ Potential issue | 🔴 Critical
🧩 Analysis chain
Review the dummy server lifecycle management for potential issues.
The
prerenderModeCommandchains commands with&&, which could lead to:- Resource leak: If
build:prerenderfails,stopDummyServerwon't execute, leaving the dummy server running. - Race condition: There's no synchronization between
startDummyServerandbuild:prerender. If the dummy server takes time to initialize, the build might start before the server is ready.
The
getCommand()helper refactoring is clean and improves readability.Consider adding error handling to ensure cleanup:
-const prerenderModeCommand = `pnpm run test:e2e:startDummyServer && pnpm build:prerender && pnpm run test:e2e:stopDummyServer && pnpm start` +const prerenderModeCommand = `pnpm run test:e2e:startDummyServer && (pnpm build:prerender; pnpm run test:e2e:stopDummyServer) && pnpm start`Or verify that the dummy server scripts include their own timeout/retry logic to handle startup delays.
🏁 Script executed:
#!/bin/bash # View the playwright config file to see the current state cat e2e/solid-start/basic/playwright.config.tsLength of output: 1965
🏁 Script executed:
#!/bin/bash # Search for dummy server script definitions in package.json or other config files fd -t f "package.json" | head -5 | xargs -I {} sh -c 'echo "=== {} ===" && grep -A 2 -B 2 "startDummyServer\|stopDummyServer" {} 2>/dev/null || true'Length of output: 254
🏁 Script executed:
#!/bin/bash # Check for any scripts directory or test setup files that might define the dummy server fd -t f "(startDummyServer|stopDummyServer|dummy)" e2e/Length of output: 0
🏁 Script executed:
#!/bin/bash # Look for any error handling or cleanup logic in e2e test setup rg -n "trap\|catch\|error\|cleanup" e2e/solid-start/basic/ --type ts --type jsLength of output: 0
🏁 Script executed:
#!/bin/bash # Search for dummy server script definitions in root package.json cat package.json | grep -A 100 '"scripts"' | head -50Length of output: 2485
🏁 Script executed:
#!/bin/bash # Search for these specific scripts across the entire codebase rg -n "startDummyServer|stopDummyServer" --type json --type ts --type js -B 1 -A 1Length of output: 1672
🏁 Script executed:
#!/bin/bash # Check if there's a workspace configuration that might define these scripts fd -t f "pnpm-workspace.yaml|turbo.json|package.json" -x grep -l "startDummyServer\|stopDummyServer" {} \;Length of output: 73
🏁 Script executed:
#!/bin/bash # View the global setup and teardown files to understand their robustness cat e2e/solid-start/basic/tests/setup/global.setup.tsLength of output: 220
🏁 Script executed:
#!/bin/bash # View teardown file cat e2e/solid-start/basic/tests/setup/global.teardown.tsLength of output: 221
🏁 Script executed:
#!/bin/bash # Check if there are any existing error handling patterns in the e2e config or setup grep -r "trap\|error\|catch\|finally" e2e/solid-start/basic/tests/setup/ --include="*.ts" -nLength of output: 0
Address dummy server lifecycle management issues in prerender command.
The resource leak and race condition concerns are confirmed valid:
- Resource leak: If
build:prerenderfails,stopDummyServernever executes due to&&chaining, leaving the background dummy server process orphaned. - Race condition:
startDummyServerruns backgrounded (&), allowingbuild:prerenderto start immediately without explicit synchronization. The server may still be initializing when the build begins.
The suggested fix using subshell syntax
(pnpm build:prerender; pnpm run test:e2e:stopDummyServer)does ensure cleanup runs, but it changes error propagation—if cleanup fails, the subsequentpnpm startalso fails.Verify and apply one of these approaches:
- Option A (Cleanup priority): Use the suggested subshell approach if cleanup failures should halt execution.
- Option B (Explicit trap): Use shell trap to guarantee cleanup:
trap 'pnpm run test:e2e:stopDummyServer' EXITbefore the build. - Option C (Explicit wait): Add explicit wait logic after
startDummyServerto ensure the dummy server is ready before proceeding.
Same issue exists in
e2e/react-start/basic/playwright.config.tsline 20.🤖 Prompt for AI Agents
In e2e/solid-start/basic/playwright.config.ts around lines 20 to 26, the prerender command uses chained commands that can leak the background dummy server and race with the build; replace the one-liner with a safe sequence that starts the dummy server, waits for it to be ready, runs build:prerender, and always stops the dummy server on exit—either (A) wrap build and cleanup in a subshell so cleanup runs and failures propagate, (B) set a shell trap to run pnpm run test:e2e:stopDummyServer on EXIT before starting the server, or (C) add an explicit readiness wait after starting the server (e.g., polling a health endpoint) then run build and finally stop the server; apply the same change to e2e/react-start/basic/playwright.config.ts at line 20.e2e/solid-start/basic/tests/search-params.spec.ts lines 3 to 4@@ -1,3 +1,4 @@11 import { expect } from '@playwright/test'22 import { test } from '@tanstack/router-e2e-utils'3-import { isSpaMode } from '../tests/utils/isSpaMode'3+import { isSpaMode } from 'tests/utils/isSpaMode'4+import { isPrerender } from './utils/isPrerender'⚠️ Potential issue | 🟡 Minor
Inconsistent import paths for utilities.
Line 3 uses
tests/utils/isSpaMode(absolute/tsconfig path) while line 4 uses./utils/isPrerender(relative path). For consistency, both utilities should use the same import pattern.Apply this diff to make imports consistent:
-import { isSpaMode } from 'tests/utils/isSpaMode' -import { isPrerender } from './utils/isPrerender' +import { isSpaMode } from './utils/isSpaMode' +import { isPrerender } from './utils/isPrerender'Or if tsconfig paths are preferred:
-import { isSpaMode } from 'tests/utils/isSpaMode' -import { isPrerender } from './utils/isPrerender' +import { isSpaMode } from 'tests/utils/isSpaMode' +import { isPrerender } from 'tests/utils/isPrerender'📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { isSpaMode } from 'tests/utils/isSpaMode' import { isPrerender } from 'tests/utils/isPrerender'🤖 Prompt for AI Agents
In e2e/solid-start/basic/tests/search-params.spec.ts around lines 3 to 4, the two utility imports use inconsistent paths (one using tsconfig/absolute 'tests/utils/isSpaMode' and the other a relative './utils/isPrerender'); make them consistent by changing the import so both use the same pattern—either update line 3 to a relative import './utils/isSpaMode' or update line 4 to the tsconfig path 'tests/utils/isPrerender' depending on the project convention (prefer tsconfig paths if that is the established pattern), and run a quick compile to ensure the chosen path resolves.birkskyum(GitHub profile, opens in a new tab) added labelsssr
birkskyum(GitHub profile, opens in a new tab) added labelsneeded-for-start-stable
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core
birkskyum(GitHub profile, opens in a new tab) removed labelsneeded-for-start-stable
birkskyum(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Walkthrough#
Adds prerender mode support and wiring for e2e: new scripts and mode detector, Playwright and Vite changes to select prerender commands and plugin options, a new prerendering test suite, and updates to existing tests to account for prerender behavior.
Changes#
e2e/solid-start/basic/package.jsonbuild:prerender,test:e2e:prerender,test:e2e:startDummyServer,test:e2e:stopDummyServer; extendedtest:e2esequence to include prerender tests.e2e/solid-start/basic/tests/utils/isPrerender.tsisPrerenderboolean (process.env.MODE === 'prerender').e2e/solid-start/basic/playwright.config.tsprerenderModeCommandandgetCommand()to select spa/prerender/ssr server command; added logging for prerender mode.e2e/solid-start/basic/vite.config.tsisPrerender; addedprerenderConfiguration(enabled, filter, maxRedirects) and conditionally passed it to tanstackStart plugin when prerender enabled.e2e/solid-start/basic/tests/prerendering.spec.tse2e/solid-start/basic/tests/search-params.spec.tsisPrerenderimport and adjusted redirect assertions to skip redirects in both SPA and prerender modes; minor import path changes.packages/start-plugin-core/src/prerender.tsSequence Diagram(s)#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
prerendering.spec.ts(file path checks and content expectations)getCommand()logic and environment handling inplaywright.config.tsprerenderConfiguration.filtercorrectness and its interaction with the start pluginPossibly related PRs#
search-params.spec.ts; related due to overlapping test adjustments.Suggested reviewers#
Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 7b61b60ae143bdc710eefe4b31008e5a53bbbb59 and d7c32dbafea44e5fcc3a869874e7f6ca1d709bea.
📒 Files selected for processing (7)
e2e/solid-start/basic/package.json(1 hunks)e2e/solid-start/basic/playwright.config.ts(4 hunks)e2e/solid-start/basic/tests/prerendering.spec.ts(1 hunks)e2e/solid-start/basic/tests/search-params.spec.ts(3 hunks)e2e/solid-start/basic/tests/utils/isPrerender.ts(1 hunks)e2e/solid-start/basic/vite.config.ts(3 hunks)packages/start-plugin-core/src/prerender.ts(1 hunks)✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
🧰 Additional context used
📓 Path-based instructions (3)
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Files:
e2e/solid-start/basic/package.jsone2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Files:
e2e/solid-start/basic/package.jsone2e/solid-start/basic/tests/utils/isPrerender.ts**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Files:
e2e/solid-start/basic/tests/utils/isPrerender.ts🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share