Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): serve the dev server in test mode #8654

Openanzal1(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8654/headopened

🎯 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-core test:eslint, test:types and test:unit pass.

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. 🦋 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
      NameType
      @tanstack/start-plugin-corePatch
      @tanstack/react-start-rscPatch
      @tanstack/react-startPatch
      @tanstack/solid-startPatch
      @tanstack/vue-startPatch

      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

    2. Review in Change Stack →

      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.ts
      The plugin no longer tracks Vite test mode or skips configureServer setup 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.md
      The 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: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring 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 Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the primary change: serving the Start dev server when Vite runs in test mode.
      Description checkPassedThe 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 checkPassedIssue #4620 requires the basic Start development server to work with vite dev --mode test. The PR removes the test-mode flag, its config hook, and the configureServer early return in `start-plug…
      Out of Scope Changes checkPassedThe 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 #4620 requires the basic Start development server to work with vite dev --mode test. The PR removes the test-mode flag, its config hook, and the configureServer early return in start-plugin-core. The new end-to-end test starts this command and verifies HTTP 200 plus Welcome 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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.