Repository navigation
feat: add browser tests, a server function demo and Knip - #12
Merged
Merged
Conversation
- 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>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
e2e/serve.tsbuilds the SSR server and the SPA, then serves the SPA under/react-ts-template/the way GitHub Pages does: files first, then directoryindex.html, then404.htmlwith 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:createServerFn(insrc/server/) together with TanStack Query. In the SPA build it shows a notice instead of calling a server that doesn't exist. A smallisSpahelper in#/lib/envreplaces the scatteredimport.meta.env.MODEchecks.pnpm lint:unused, as part ofpnpm check, and in CI. It flagged two exports insrc/queries/posts.ts, which are now private.oxc-transform-react, because@vitejs/plugin-reactonly 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.Detailed Explanation
The browser tests cover the regressions found by hand while building the SPA/SSR setup:
404.htmlTo confirm they catch real bugs, I temporarily removed the
ClientOnlyworkaround 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_GREETINGnor 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:pnpm check(format, lint, typecheck, Knip)pnpm testpnpm test:e2epnpm lint:reactactionlintpasses on the updated CI workflow.Checklist
pnpm checkandpnpm testpass🤖 Generated with Claude Code