chore: Co-locate unit tests and update test conventions

- QA skill: unit tests placed next to source files (co-located)
  instead of src/__tests__/ directory
- CLAUDE.md: add test convention note and full test script reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
“alexvisualmakers”
2026-03-31 09:31:24 +02:00
parent 6f1f909bb0
commit ef85ee746f
2 changed files with 9 additions and 5 deletions

View File

@@ -65,7 +65,7 @@ npm run test:e2e # Playwright: E2E tests from previous QA runs
Note any failures — these are regressions and must be treated as High bugs. Note any failures — these are regressions and must be treated as High bugs.
### 6. Write Unit Tests ### 6. Write Unit Tests
Before E2E tests, identify and test isolated logic with Vitest in `src/__tests__/PROJ-X-*.test.ts`: Before E2E tests, identify and test isolated logic with Vitest. Place tests **co-located** next to the source file (e.g. `src/hooks/useFeature.test.ts` next to `src/hooks/useFeature.ts`):
**What to unit test (evaluate each):** **What to unit test (evaluate each):**
- Custom hooks with non-trivial logic (e.g. `useKanbanStorage`: localStorage read/write, error fallback) - Custom hooks with non-trivial logic (e.g. `useKanbanStorage`: localStorage read/write, error fallback)

View File

@@ -47,6 +47,7 @@ All features tracked in `features/INDEX.md`. Every skill reads it at start and u
- **Single Responsibility:** One feature per spec file - **Single Responsibility:** One feature per spec file
- **shadcn/ui first:** NEVER create custom versions of installed shadcn components - **shadcn/ui first:** NEVER create custom versions of installed shadcn components
- **Human-in-the-loop:** All workflows have user approval checkpoints - **Human-in-the-loop:** All workflows have user approval checkpoints
- **Tests:** Unit tests co-located next to source files (`useHook.test.ts` next to `useHook.ts`). E2E tests in `tests/`.
## Build & Test Commands ## Build & Test Commands
@@ -55,6 +56,9 @@ npm run dev # Development server (localhost:3000)
npm run build # Production build npm run build # Production build
npm run lint # ESLint npm run lint # ESLint
npm run start # Production server npm run start # Production server
npm test # Vitest unit/integration tests
npm run test:e2e # Playwright E2E tests
npm run test:all # Both test suites
``` ```
## Product Context ## Product Context