ccfb08f4d5
Follow-up to #20, which was merged before this landed. bot-agents has no `package.json` `imports` aliases (`src/` is flat and everything imports relatively), so no code changes. This records the new rule in the docs: - `.agents/memory/imports-aliases-barrels.md`: aliases may target only a direct subfolder of `src/` (its `index.ts` or a `#x/*` pattern); nothing outside `src/`, not `src/` itself, not deeper folders; such code imports relatively. - `.agents/memory/tests-layout-vitest.md`: `tests/` reach the public entry through a relative import, not a `#plugin` alias. - `.agents/skills/migrate-deno-repo/SKILL.md` and `AGENTS.md`: same rule. `vp check`, `vp test`, and `damem doctor` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #21 Reviewed-by: bot <noreply@capsulizers.com> Co-authored-by: Danny Kim <temeddix@gmail.com> Co-committed-by: Danny Kim <temeddix@gmail.com>
40 lines
1.9 KiB
Markdown
40 lines
1.9 KiB
Markdown
---
|
|
description: Vitest via vp test; unit tests sit next to code as *.test.ts, regression/integration tests in tests/ via the public entry (through its # alias, never ../); scripts/ has no tests
|
|
---
|
|
|
|
Decided 2026-10-14 for all repos.
|
|
|
|
- **Runner:** Vitest through `vp test`. Import test APIs from
|
|
`vite-plus/test` (`describe`, `expect`, `it`).
|
|
- **Unit tests** sit next to the code: `src/foo/bar.ts` is tested in
|
|
`src/foo/bar.test.ts`. Vitest's default include finds them; no `test`
|
|
config needed. Packages publish only `dist/`, so colocated tests cost nothing
|
|
in the tarball.
|
|
- **Regression and integration tests** live in the top-level `tests/` folder
|
|
and use only the public entry point, imported through its `#` alias (e.g.
|
|
`#plugin` for `./src/plugin/index.ts`), never internals and never `../`,
|
|
which is banned in every file. `vp test tests` runs just these
|
|
([[imports-aliases-barrels]]). In bot-agents, `tests/` imports only
|
|
`#testing` (`./src/testing/index.ts`), plain helpers that import no source
|
|
module.
|
|
- **No in-source tests** (`import.meta.vitest`).
|
|
- **`scripts/` gets no tests** (2026-10-15): it is repo tooling, not
|
|
production code (`project-lint.ts`, `protect-source.sh`).
|
|
- Test files follow every lint rule; no relaxed overrides for tests.
|
|
|
|
## Migrating Deno tests
|
|
|
|
`Deno.test` suites were converted by a codemod
|
|
(`~/.local/share/deno-migration/src/convert.ts` on the user's machine), then
|
|
its TODOs finished by hand. Watch for:
|
|
|
|
- `@std/assert` → `expect` (`assertEquals` → `toStrictEqual` or `toBe`,
|
|
`assertThrows` → `toThrow`, `assertRejects` → `rejects.toThrow`);
|
|
- `Deno.*` file, env, and process APIs → `node:fs`, `process.env`,
|
|
`node:child_process`;
|
|
- `t.step` → nested `describe`/`it`;
|
|
- sanitizer options, which Vitest doesn't have.
|
|
|
|
A migration PR must keep every test case; a dropped case is lost coverage.
|
|
Tests must pass locally before any push.
|