fix(start-plugin-core): serve the dev server in test mode #8654
main fromrefs/pull/8654/head·opened 🎯 Changes#
Fixes #4620
vite dev --mode test returned 404 Cannot GET / for the Vite-only Start fixture.
Root cause: devServerPlugin in start-plugin-core set an isTest flag from the Vite mode and returned early from configureServer when it was set. That skipped the SSR middleware (and the dev styles endpoint), so nothing handled the request and Vite's fallback answered 404. Nitro-backed setups install their own handler, which is why the Nitro basic example still worked.
Fix: remove the isTest flag, the config hook that set it, and the early return. The existing checks on installDevServerMiddleware, middlewareMode and the SSR environment type still decide whether the middleware is installed.
Tests: new e2e/react-start/basic/tests/dev-test-mode.spec.ts. It starts vite dev --mode test on a free port and asserts / returns 200 with the home page content. It runs once, in the vite ssr mode.
- Before the fix:
404, test fails. - After the fix:
200, test passes. start-plugin-coretest:eslint,test:typesandtest:unitpass.
Builds on #4642 and #5181 by luixo, which removed the same early return. #5181 was closed after the Start plugin moved on, so this applies the change to the current code and adds the regression coverage requested in the issue.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
- I fully understand the code in this pull request, including any code generated with AI assistance.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Written with the help of an agent (Claude Code, claude-opus-5-5 orchestrating claude-sonnet-5-5).
Summary by CodeRabbit#
- Bug Fixes
- Fixed an issue where running the app in Vite’s test mode could show a “404 Cannot GET /” error instead of loading the home page.
- The home page now loads successfully in this mode, and visitors can see the “Welcome Home!!!” content.
- Other development modes continue to work as before.
- 1
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: TanStack/router/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f0e5b036-48df-4990-8678-d2e507531da8
📥 Commits
-
Reviewing files that changed from the base of the PR and between 0548404c7ba21d0c34028f95fc91dcf78164b6d8 and 801e6f3eb5f40a7efb201efbf8e15368cda23306.
📒 Files selected for processing: 1
-
packages/start-plugin-core/src/vite/dev-server-plugin/plugin.ts
💤 Files with no reviewable changes: 1
-
- packages/start-plugin-core/src/vite/dev-server-plugin/plugin.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
The Start dev-server plugin now runs its server setup in Vite test mode. An end-to-end test starts the server in that mode and checks that the home page loads. A patch changeset records the fix.
Changes: Vite test-mode dev server
Layer / File(s) Summary Enable dev-server setup in test mode
packages/start-plugin-core/src/vite/dev-server-plugin/plugin.tsThe plugin no longer tracks Vite test mode or skips configureServersetup when test mode is active.Verify the home page response
e2e/react-start/basic/tests/dev-test-mode.spec.ts,.changeset/quiet-test-mode-dev.mdThe Playwright test starts Vite in test mode, checks for a successful home page response and visible welcome text, and stops the server. The changeset records a patch release for the plugin. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
801e6-
The change allows the Vite-only Start development server to serve pages in test mode, with no identified merge-blocking risk.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Title check The title clearly and concisely describes the primary change: serving the Start dev server when Vite runs in test mode. Description check The description explains the issue, root cause, fix, test coverage, validation results, checklist completion, release impact, and AI assistance disclosure. It follows the required template and provide… Linked Issues check Issue #4620requires the basic Start development server to work withvite dev --mode test. The PR removes the test-mode flag, itsconfighook, and theconfigureServerearly return in `start-plug…Out of Scope Changes check The plugin change directly removes the test-mode bypass described by issue #4620. The end-to-end test provides regression coverage, and the changeset documents the published fix. No unrelated changes …Full details: Description check
-
Explanation
The description explains the issue, root cause, fix, test coverage, validation results, checklist completion, release impact, and AI assistance disclosure. It follows the required template and provides sufficient implementation context.
Full details: Linked Issues check
-
Explanation
Issue
#4620requires the basic Start development server to work withvite dev --mode test. The PR removes the test-mode flag, itsconfighook, and theconfigureServerearly return instart-plugin-core. The new end-to-end test starts this command and verifies HTTP 200 plusWelcome Home!!!.
Full details: Out of Scope Changes check
-
Explanation
The plugin change directly removes the test-mode bypass described by issue
#4620. The end-to-end test provides regression coverage, and the changeset documents the published fix. No unrelated changes appear in the whole-PR summary.
-
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment `@coderabbitai help` to get the list of available commands.-
anzal1(GitHub profile, opens in a new tab) linked this to fix #4620
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 801e6f3eb5f40a7efb201efbf8e15368cda23306
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR