0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/docs/start/framework/react/guide
Manuel Schiller 6ddaed9f70 feat(start): experimental Vitest support and typed test helpers
- With `tanstackStart()` in a config that Vitest loads, test files are
  compiled as the app's code is: for the client in browser mode, jsdom
  and happy-dom, for the server in Node. A test run sets up no dev
  server, preview server or build. A project needs no router entry and
  no routes. The route tree is generated once, and route files are never
  written.
- `mockServerFn` and `resetServerFnMocks` in `<framework>-start/testing`:
  in a client test a server function call goes to a mock that is typed
  from the function, in place of a request.
- `runInRequest`, `mockMiddleware` and `runMiddleware` in
  `<framework>-start/testing/server`: a server test runs server functions
  and middleware for a request it describes.
- Mocks end with the test that registered them. The plugin adds a setup
  file to every Vitest project for that.
- In a test run the server finds a server function by its id alone.
  Vitest serves compiled modules from its cache from the second run on,
  so the compiler has no record of them.
- In a test run Start names its packages in `resolve.noExternal` with
  regular expressions. Vitest's translation of the wildcards does not
  match a `-`, so jsdom and Node tests of an installed project ran
  `@tanstack/start-client-core` uncompiled.
- `@tanstack/react-start` pre-bundles `@tanstack/react-store` by a path
  that also resolves from a project that depends on Start only.
- `scripts/e2e/run-as-installed.mjs` runs an e2e project from a
  `pnpm deploy` copy, where `@tanstack/*` are in `node_modules` as in a
  user's project.
- `e2e/react-start/vitest-library` and `e2e/react-start/vitest-app` run
  their tests with an empty Vitest cache, from the warm cache and as an
  installed project.
- Docs: `docs/start/framework/react/guide/testing.md`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
History 2026-11-15 17:10:33 +01:00
..
authentication-overview.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
authentication-server-primitives.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
authentication.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
cdn-asset-urls.md docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +02:00
client-entry-point.md docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +02:00
code-execution-patterns.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
css-styling.md docs (#7520) 2026-06-01 21:46:55 +02:00
databases.md docs(start): describe key search entry pages (#8367) 2026-09-11 14:47:42 -06:00
deferred-hydration.md docs: use new query methods (#7100) 2026-10-06 17:59:20 +02:00
early-hints.md perf: lower manifest script preload priority (#8212) 2026-10-16 15:35:33 +02:00
environment-functions.md docs(start): troubleshoot server and client execution boundaries (#8394) 2026-11-05 21:26:23 -07:00
environment-variables.md docs: Update environment variable validation to use z.url() (#5570) 2026-07-17 20:47:19 +02:00
error-boundaries.md docs: Fix frontmatter title field (#6753) 2026-02-24 20:28:51 +01:00
execution-model.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
geo.md docs(start): rename LLM optimization guide to GEO (#7620) 2026-06-12 11:24:22 -06:00
hosting.md docs(start): troubleshoot Cloudflare deployment config (#8396) 2026-11-05 21:26:13 -07:00
hydration-errors.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
import-protection.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
isr.md docs(start): fix tutorial and ISR guide links (#8366) 2026-09-11 14:36:09 -06:00
middleware.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
observability.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
path-aliases.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
production-checklist.md docs(start): add production release checklist (#8373) 2026-09-11 17:14:04 -06:00
rendering-markdown.md docs(start): use TanStack Markdown in rendering guide (#8808) 2026-10-24 14:38:14 -06:00
routing.md docs: remove gitignore suggestion for generated route tree file (#6025) 2025-12-05 22:05:19 +01:00
selective-ssr.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
seo.md docs(start): describe key search entry pages (#8367) 2026-09-11 14:47:42 -06:00
server-components.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
server-entry-point.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
server-functions.md fix(start-plugin-core): refuse custom server-fn ids that never worked over HTTP, deprecate the rest outside the unreserved set (#8858) 2026-11-08 11:42:06 +01:00
server-routes.md docs(start): clarify server functions vs server routes (#7651) 2026-06-18 12:49:10 +02:00
spa-mode.md docs (#7520) 2026-06-01 21:46:55 +02:00
static-prerendering.md docs (#7520) 2026-06-01 21:46:55 +02:00
static-server-functions.md docs: Move files to Guides section (#5441) 2025-10-11 17:53:56 +02:00
streaming-data-from-server-functions.md docs: Move files to Guides section (#5441) 2025-10-11 17:53:56 +02:00
tailwind-integration.md docs (#7521) 2026-06-01 22:05:37 +02:00
tanstack-query.md docs(start): record verified Query recipe versions (#8387) 2026-11-05 21:26:02 -07:00
testing.md feat(start): experimental Vitest support and typed test helpers 2026-11-15 17:10:33 +01:00