Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .claude/rules/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Testing rules and patterns
paths:
- '**/*.test.ts'
- '**/*.spec.ts'
- 'tests/**'
- 'e2e/**'
- 'src/test/**'
---

Expand All @@ -20,10 +20,12 @@ Write all test titles in English. Use descriptive sentences that state the expec

## Test Types

| Type | Tool | Location | Run Command |
| ---- | ---------- | ----------------------------------------------------------------- | ----------------------- |
| Unit | Vitest | `src/test/` (mirrors `src/lib/`) or co-located in `src/features/` | `pnpm test:unit` |
| E2E | Playwright | `tests/` | `pnpm test:integration` |
| Type | Tool | Location | Run Command |
| ---- | ---------- | ----------------------------------------------------------------- | ---------------- |
| Unit | Vitest | `src/test/` (mirrors `src/lib/`) or co-located in `src/features/` | `pnpm test:unit` |
| E2E | Playwright | `e2e/` | `pnpm test:e2e` |

E2E test files must use the `.spec.ts` extension. `playwright.config.ts` matches only `*.spec.ts`, so `.test.ts` files will not be detected.

## Assertions

Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/session-close/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run both checks and fix any failures before proceeding:

```bash
pnpm test:unit
pnpm test:integration
pnpm test:e2e
pnpm check
```

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

# TODO: Run integration test
# - name: Integration test
# run: pnpm test:integration
# run: pnpm test:e2e

preview:
if: ${{ github.ref != 'refs/heads/main' }}
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pnpm dev # Start dev server (localhost:5174)
pnpm build # Build for production
pnpm test # Run all tests
pnpm test:unit # Vitest unit tests
pnpm test:integration # Playwright E2E tests
pnpm test:e2e # Playwright E2E tests
pnpm coverage # Report test coverage
pnpm lint # ESLint check
pnpm format # Prettier format
Expand Down Expand Up @@ -61,7 +61,7 @@ src/features/ # Feature-scoped code (single domain)
│ └── utils/ # Feature utilities
│ └── _.test.ts # Tests co-located next to source
src/test/ # Unit tests (mirrors src/lib/)
tests/ # E2E tests (Playwright)
e2e/ # E2E tests (Playwright)
prisma/schema.prisma # Database schema
```

Expand All @@ -71,7 +71,7 @@ prisma/schema.prisma # Database schema
- **Service layer**: Services return data or `null`; never call `error()` or `redirect()`. HTTP error translation belongs in the route handler — the service must stay framework-agnostic and unit-testable.
- **Server data**: `+page.server.ts` → `+page.svelte` via `data` prop
- **Forms**: Superforms + Zod validation
- **Tests**: Write tests before implementation (TDD). Use `@quramy/prisma-fabbrica` for factories only in `prisma/seed.ts` and Playwright global setup (`tests/global-setup.ts`). For service-layer unit tests, mock the DB with `vi.mock('$lib/server/database', ...)` — do not use fabbrica there. Use Nock for HTTP mocking
- **Tests**: Write tests before implementation (TDD). Use `@quramy/prisma-fabbrica` for factories only in `prisma/seed.ts`. For service-layer unit tests, mock the DB with `vi.mock('$lib/server/database', ...)` — do not use fabbrica there. Use Nock for HTTP mocking
- **Naming**: `camelCase` variables, `PascalCase` types/components, `snake_case` files/routes, `kebab-case` directories
- **Pre-commit**: Lefthook runs Prettier + ESLint (bypass: `LEFTHOOK=0 git commit`)

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ features/workbooks/services/

- テストファクトリ(`@quramy/prisma-fabbrica`)
- テストヘルパー・フィクスチャ
- E2E テスト(`tests/`)
- E2E テスト(`e2e/`)

### Vitest 設定

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Claude Code の拡張ポイントの使い分けをまとめる。
description: Testing rules and patterns
paths:
- '**/*.test.ts'
- 'tests/**'
- 'e2e/**'
---
```

Expand All @@ -45,7 +45,7 @@ paths:
| ファイル | スコープ |
| ---------------------- | -------------------------------------------------------- |
| `coding-style.md` | 言語レベルの記述スタイル(ブレース・命名・型エイリアス) |
| `testing.md` | `*.test.ts`, `tests/**` のテストパターン |
| `testing.md` | `*.test.ts`, `*.spec.ts`, `e2e/**` のテストパターン |
| `svelte-components.md` | `*.svelte` コンポーネント設計方針 |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
| `prisma-db.md` | `prisma/**`, `src/lib/server/**` の DB・サービス層規約 |
| `auth.md` | 認証関連 |
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"dev": "vite dev",
"build": "prisma generate && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"test": "npm run test:e2e && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"test:integration": "playwright test",
"test:e2e": "playwright test",
"test:unit": "vitest",
"postinstall": "prisma generate",
"db:seed": "pnpm exec tsx ./prisma/seed.ts",
Expand Down
14 changes: 2 additions & 12 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@ const config: PlaywrightTestConfig = {
use: {
baseURL: process.env.BASE_URL ?? 'http://localhost:4173',
},
testDir: 'tests',
testDir: 'e2e',
projects: [
//{
// name: 'setup db',
// testMatch: /global\.setup\.ts/,
// teardown:'cleanup db',
//},
//{
// name: 'cleanup db',
// testMatch: /global\.teardown\.ts/,
//},
{
name: 'all',
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
//dependencies: ['setup db'],
testMatch: /(.+\.)?spec\.[jt]s/,
},
],
};
Expand Down
Loading