|
| 1 | +# Repository guidelines |
| 2 | + |
| 3 | +## Project structure & module organization |
| 4 | + |
| 5 | +- Run workspace commands from the repository root; `pnpm-workspace.yaml` wires packages and shared tooling. |
| 6 | +- Core implementation lives in `packages/core/src`, with mirrored tests in `packages/core/tests` (for example, `src/core/plugins/mockLoader.mjs` ↔ `tests/core/mockLoader.test.ts`). |
| 7 | +- `examples/` holds usage demos, `e2e/` carries integration suites and fixtures, and `scripts/` plus `website/` supply build utilities and documentation assets. |
| 8 | +- Keep assets, fixtures, and build artifacts inside the package that owns them to avoid cross-package coupling. |
| 9 | + |
| 10 | +## Build, test, and development commands |
| 11 | + |
| 12 | +- `pnpm install` installs the entire workspace. |
| 13 | +- `pnpm --filter @rstest/core build` compiles the core package via Rslib. |
| 14 | +- `pnpm --filter @rstest/core dev` watches the core build for rapid iteration. |
| 15 | +- `pnpm --filter @rstest/core test` executes the unit suite; add `-- tests/core/mockLoader.test.ts` for a single file and append `-- --updateSnapshot` only when behavior changes. |
| 16 | +- `pnpm e2e` runs the browser-level regression suite inside `e2e/`. |
| 17 | +- `pnpm biome check` (aliased by `pnpm lint`) formats code, enforces lint rules, and performs spell checks. |
| 18 | + |
| 19 | +## Coding style & naming conventions |
| 20 | + |
| 21 | +- Treat packages as ESM-first: use `.mjs` for runtime loaders and `.ts` for typed utilities; avoid mixing CommonJS helpers. |
| 22 | +- Follow two-space indentation, LF line endings, and keep files ASCII unless the feature already relies on Unicode. |
| 23 | +- Use `camelCase` for locals, `PascalCase` for exported types/components, and `SCREAMING_SNAKE_CASE` only for shared constants. |
| 24 | +- Keep modules focused on a primary export with internal helpers defined nearby, and run `pnpm biome check` or `pnpm format` before committing. |
| 25 | + |
| 26 | +## Testing guidelines |
| 27 | + |
| 28 | +- Unit tests use `@rstest/core`; place new specs under `packages/<pkg>/tests` mirroring the source layout. |
| 29 | +- Run targeted suites during development (`pnpm --filter @rstest/core test -- tests/core/<suite>.test.ts`), then execute the full filter before pushing. |
| 30 | +- Integration flows live in `e2e/`; isolate fixtures per scenario and trigger them via `pnpm e2e`. |
| 31 | +- Cover success paths, error handling, and transformation edge cases. Update snapshots deliberately and keep coverage thresholds from `rstest.config.ts` intact. |
| 32 | + |
| 33 | +## Commit & pull request guidelines |
| 34 | + |
| 35 | +- Follow Conventional Commits (`type(scope): subject`) consistent with the existing history (`feat`, `fix`, `docs`, `chore`). |
| 36 | +- Each PR should explain motivation, summarize key changes, attach relevant test command output, and reference issues or discussions. |
| 37 | +- Ensure `pnpm lint` and the necessary test commands succeed before requesting review, and keep diffs scoped for efficient feedback. |
0 commit comments