Skip to content

Demo Site: add unit testing setup with Vitest - #6289

Open
VPS-Obi wants to merge 3 commits into
mainfrom
claude/vitest-unit-test-setup-rb8b8v
Open

Demo Site: add unit testing setup with Vitest#6289
VPS-Obi wants to merge 3 commits into
mainfrom
claude/vitest-unit-test-setup-rb8b8v

Conversation

@VPS-Obi

@VPS-Obi VPS-Obi commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Adds a unit testing setup to the site. This was first proposed in vivid-planet/dextinity-starter#395 and rejected due to no real world examples. However, since some of our projects already have a unit testing setup in the site (e.g., an online shop) and writing unit tests becomes effortless with agentic coding, I suggest to revise this decision and add a unit testing setup to the Demo/Starter.

https://claude.ai/code/session_01BTrAyuuTjXFqBTp9ip9bXp

Enable writing unit tests in demo/site, matching the existing setup in
demo/api and the site packages: jsdom environment, tsconfig path aliases
via vite-tsconfig-paths, and a JUnit report for CI test reporting. The
root test:unit script picks it up automatically via --if-present.
Includes a test for createSitePath as an example.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BTrAyuuTjXFqBTp9ip9bXp
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 886ee293-b95d-43b7-8571-ab035b4d46f4

📥 Commits

Reviewing files that changed from the base of the PR and between 504c97f and fd992cd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • demo/site/package.json
  • demo/site/src/util/createSitePath.test.ts
  • demo/site/vitest.config.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The demo site now uses Vitest for unit tests. Its configuration enables jsdom, TypeScript path resolution, and JUnit output. New createSitePath tests cover valid and invalid paths. CI uploads the generated JUnit reports.

Changes

Vitest unit-test reporting

Layer / File(s) Summary
Vitest setup and unit coverage
demo/site/package.json, demo/site/vitest.config.ts, demo/site/src/util/createSitePath.test.ts
The demo site adds Vitest scripts and development dependencies. The configuration enables jsdom, TypeScript path resolution, excluded directories, default and JUnit reporters, and JUnit output. Tests cover language prefixes and invalid paths.
JUnit artifact upload
.github/workflows/test.yml
The unit-test artifact upload now includes demo/*/junit-unit.xml reports.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to fd992

This PR adds a localized Vitest unit-testing setup and CI test command without any supplied evidence of merge-blocking correctness, security, availability, or deployment risk; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding a Vitest unit testing setup to the demo site.
Description check ✅ Passed The description explains the addition of unit testing to the demo site and provides relevant context for the change.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/vitest-unit-test-setup-rb8b8v

Comment @coderabbitai help to get the list of available commands.

Match the file name the test workflow's artifact upload expects.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BTrAyuuTjXFqBTp9ip9bXp
Include demo/*/junit-unit.xml in the test-results-unit artifact so demo
test reports show up in the test report, alongside the packages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BTrAyuuTjXFqBTp9ip9bXp
@VPS-Obi VPS-Obi self-assigned this Sep 2, 2026
@VPS-Obi VPS-Obi added the needs-starter-pr Change in Demo that needs to be changed in Starter as well. label Sep 2, 2026
@VPS-Obi VPS-Obi changed the title Add unit testing setup with Vitest Demo Site: add unit testing setup with Vitest Sep 2, 2026
@VPS-Obi
VPS-Obi marked this pull request as ready for review September 2, 2026 06:47
@macroscopeapp

macroscopeapp Bot commented Sep 2, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at fd992cd

Macroscope's review found this PR approvable — This PR adds isolated Vitest tooling, a focused unit test, lockfile entries, and CI report collection without changing production application code or customer request behavior. Its runtime impact is confined to local and CI test execution.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-starter-pr Change in Demo that needs to be changed in Starter as well.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants