|
| 1 | +# Monorepo (pnpm) |
| 2 | + |
| 3 | +- Work primarily in: |
| 4 | + • src/ |
| 5 | + • webview-ui/package |
| 6 | + • packages/types (shared DTOs) |
| 7 | +- Other workspaces (modify only if instructed): |
| 8 | + • evals/ |
| 9 | + • packages/_/ |
| 10 | + • apps/_/ |
| 11 | + • [others] |
| 12 | +- To install deps: |
| 13 | + → run `pnpm add <package>` in `<cwd>workspace/directory</cwd>` (updates `<workspace>/package.json`) |
| 14 | +- ⚠️ DO NOT run pnpm in root (root only holds CLI dev-tools in devDependencies, e.g. prettier) |
| 15 | + |
| 16 | +# Turborepo |
| 17 | + |
| 18 | +- ❌ Don’t modify `turbo` config without instruction |
| 19 | +- ✅ You may propose config changes when: |
| 20 | + 1. Adding a shared, cacheable npm task |
| 21 | + 2. Declaring an internal-package dependency that affects the extension build |
| 22 | + |
| 23 | +# Running tests |
| 24 | + |
| 25 | +- Always execute commands using `<cwd>workspace/directory</cwd>` when running any test command |
| 26 | +- To fix failures: |
| 27 | + 1. Target one failing test: |
| 28 | + → `npx vitest relative/path/__tests__/name.spec.ts -t "substring"` |
| 29 | + 2. Verify all tests in that module pass: |
| 30 | + → `npx vitest relative/path/__tests__/name.spec.ts` |
| 31 | +- File conventions: |
| 32 | + • `.spec.ts` → vitest |
| 33 | + • `.test.ts` → jest (deprecated) |
| 34 | +- If a test in `.test.ts` fails: |
| 35 | + → delete it & recreate in `.spec.ts` |
| 36 | +- Keep passing tests in `.test.ts` |
| 37 | +- Use `npx jest <file> -t "substring"` for deprecated test execution using the same strategy above |
| 38 | +- Run all tests in the root workspace: |
| 39 | + → `pnpm test` |
| 40 | + |
| 41 | +# Creating tests |
| 42 | + |
| 43 | +- Use vitest (native ESM, jest-compatible) |
| 44 | +- Steps: |
| 45 | + 1. Create `path/to/__tests__/name.spec.ts` (must be `.spec.ts`) |
| 46 | + 2. Omit ESM mocks unless necessary |
| 47 | + 3. Run via vitest |
| 48 | +- For modules with existing `.test.ts`: |
| 49 | + 1. Move any failing tests → `name.spec.ts` |
| 50 | + 2. Add new tests → `name.spec.ts` |
| 51 | + 3. Leave successful tests in `.test.ts` |
0 commit comments