Skip to content

feat: add browser tests, a server function demo and Knip - #12

Merged
FerMPY merged 1 commit into
mainfrom
e2e-server-fn-knip
Oct 10, 2026
Merged

FerMPY merged 1 commit into
mainfrom
e2e-server-fn-knip

Conversation

@FerMPY

@FerMPY FerMPY commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary of Changes

  • Playwright browser tests for both builds. e2e/serve.ts builds the SSR server and the SPA, then serves the SPA under /react-ts-template/ the way GitHub Pages does: files first, then directory index.html, then 404.html with a 404 status. Every test also fails on console errors, so hydration mismatches show up. They run in CI as a new "Browser tests (SSR and SPA)" job, which uploads traces on failure.
  • Server function demo at /server: createServerFn (in src/server/) together with TanStack Query. In the SPA build it shows a notice instead of calling a server that doesn't exist. A small isSpa helper in #/lib/env replaces the scattered import.meta.env.MODE checks.
  • Knip checks for unused files, exports and dependencies. It runs as pnpm lint:unused, as part of pnpm check, and in CI. It flagged two exports in src/queries/posts.ts, which are now private.
  • Dependabot now skips minor bumps of oxc-transform-react, because @vitejs/plugin-react only accepts ^0.152.0. That replaces chore(deps-dev): bump oxc-transform-react from 0.152.0 to 0.153.0 in the vite-and-vitest group #11.
  • README and AGENTS.md document all of the above.

Detailed Explanation

The browser tests cover the regressions found by hand while building the SPA/SSR setup:

  • deep links served from 404.html
  • the active nav link on a deep link
  • not-found pages
  • dark mode
  • server function calls from the browser

To confirm they catch real bugs, I temporarily removed the ClientOnly workaround in __root.tsx. The SPA tests then failed on React error #418 and on the stale active link.

The server function's code stays on the server. The client assets contain neither SERVER_GREETING nor the default message, and the SSR page renders the env var.

Knip is pinned to ^6.40.0. 6.41.0 is less than a day old, so pnpm's minimum-release-age policy rejects it, and I didn't want to add an exception to the template.

Verification

From a clean pnpm install --frozen-lockfile:

Check Result
pnpm check (format, lint, typecheck, Knip) ✅
pnpm test ✅ 6 tests
pnpm test:e2e ✅ 12 tests (6 per build)
Both builds ✅
pnpm lint:react ✅ 100/100

actionlint passes on the updated CI workflow.

Checklist

  • I have tested these changes thoroughly
  • pnpm check and pnpm test pass
  • I have updated the documentation (if required)
  • I have added/updated unit tests (if applicable)

🤖 Generated with Claude Code

- Playwright tests run against both the SSR server and the SPA hosted
  under a sub-path like GitHub Pages (e2e/serve.ts builds and serves
  both). They fail on console errors, so hydration mismatches and broken
  deep links get caught. Runs in CI as a new "Browser tests" job.
- /server demonstrates createServerFn with TanStack Query; the SPA build
  shows a notice instead of calling a server that doesn't exist.
- Knip checks for unused files, exports and dependencies (`pnpm
  lint:unused`, part of `pnpm check` and CI). It flagged two exports in
  src/queries/posts.ts that are now private.
- Dependabot skips minor bumps of oxc-transform-react, since
  @vitejs/plugin-react only accepts its 0.152.x range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 49d001f.

@FerMPY
FerMPY merged commit d08afa6 into main Oct 10, 2026
9 checks passed
@FerMPY
FerMPY deleted the e2e-server-fn-knip branch October 10, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant