Skip to content

feat(test-harness): vitest across workspaces + test helpers#12

Merged
themightychris merged 6 commits into
mainfrom
feat/test-harness
May 16, 2026
Merged

feat(test-harness): vitest across workspaces + test helpers#12
themightychris merged 6 commits into
mainfrom
feat/test-harness

Conversation

@themightychris
Copy link
Copy Markdown
Member

Summary

  • Vitest configured per-workspace (node environment for api/shared, jsdom for web); root npm test fans out to all workspaces in parallel
  • Test helpers for gitsheets-backed code (createTestRepo + seed), filesystem-backed private store (createTestPrivateStore), and outbound HTTP mocking (createGitHubMock, createResendMock via MSW)
  • Web: renderWithRouter helper wraps RTL render in MemoryRouter; @testing-library/jest-dom matchers wired via setup file
  • CI: Test step added before Build in ci.yml

Test plan

  • npm test runs the suite from root and passes (3 api tests, 2 web tests, 1 shared test)
  • One placeholder test per workspace asserts expect(1+1).toBe(2) — proves harness loads
  • createTestRepo end-to-end verified: create repo with people sheet, seed a record, queryFirst, cleanup
  • createTestPrivateStore end-to-end verified: putProfile, getProfile, findPersonIdByEmail, cleanup
  • CI exits non-zero on a deliberately-broken test — to be confirmed once CI runs on this PR; see Notes in plan closeout commit

🤖 Generated with Claude Code

Commands:
  npm install --save-dev vitest
  npm install --save-dev gitsheets@^1.0.3 msw@^2 -w apps/api
  npm install --save-dev @testing-library/react@^16 @testing-library/user-event@^14 @testing-library/jest-dom@^6 @vitest/browser jsdom -w apps/web
Commands:
  npm pkg set scripts.test="vitest run" -w apps/api -w apps/web -w packages/shared
  npm pkg set scripts.test="npm run test --workspaces --if-present"
  npm install react-router@^7 -w apps/web
- Vitest config per workspace: node env for api/shared, jsdom for web
- Root npm test fans out to all workspaces
- apps/api/tests/helpers/test-repo.ts: createTestRepo (isolated git repo +
  gitsheets Repository) and seed (upsert records via transact)
- apps/api/tests/helpers/test-private-store.ts: createTestPrivateStore
  (filesystem-backed shim with putProfile/getProfile/findPersonIdByEmail)
- apps/api/tests/helpers/mocks.ts: createGitHubMock and createResendMock
  via MSW for intercepting outbound HTTP in tests
- apps/web/tests/test-utils.tsx: renderWithRouter wraps RTL render with
  MemoryRouter for route-aware component tests
- Placeholder tests in each workspace assert the harness loads
- CI: add Test step before Build in ci.yml
The web vitest config uses jsdom environment, not browser mode. @vitest/browser
was dead weight — nothing in the tree imports or references it.
@themightychris themightychris merged commit 77c79e2 into main May 16, 2026
1 check passed
@themightychris themightychris deleted the feat/test-harness branch May 16, 2026 18:45
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