airbroke / __tests__
AGENTS.md221 starsChanged 6 months agoMITView on GitHub
All Vitest tests live here and mirror runtime boundaries. Tests run serially in the dedicated test service against testdb, never the development database. - Use // @vitest-environment node for server-only route, auth, or SDK tests; the default environment is jsdom. - Run deterministic checks with docker compose -f docker-compose.yml --profile test run --rm test yarn test --run; the test service is one-shot and starts its dedicated database through the profile. - Keep tests under this tree rather than beside Next…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- app/AGENTS.mdAGENTS.md
- components/AGENTS.mdAGENTS.md
- lib/AGENTS.mdAGENTS.md
- prisma/AGENTS.mdAGENTS.md
The file
We split this AGENTS.md into the rules it gives an agent
10 rules. About 1 is common, 4 are distinctive, and 5 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
All Vitest tests live here and mirror runtime boundaries.
- Very specific: line 31
Use // @vitest-environment node for server-only route, auth, or SDK tests.
- Very specific: line 33
Run deterministic checks with docker compose -f docker-compose.yml --profile test run --rm test yarn test --run.
- Distinctive: line 37
Keep tests under this tree rather than beside Next application source.
- Very specific: line 40
Prefer real NextRequest, parser, generated client, or narrow collaborator calls at drift-prone boundaries.
- Very specific: line 48
Do not execute tests through web.
- Distinctive: line 49
Do not rely on file concurrency or test order.
- Common: line 51
Do not test only accepted input when changing auth, origin/CORS, collector, MCP, payload-limit, or credential behavior.
- Distinctive: line 53
Do not assert redirect behavior by replacing the repository navigation helper with a one-off incompatible mock.
- Distinctive: line 55
Do not treat coverage inclusion as proof of behavioral coverage.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TEST GUIDE
OVERVIEW
All Vitest tests live here and mirror runtime boundaries. Tests run serially in
the dedicated test service against testdb, never the development database.
STRUCTURE
api/ # Collector, completion, and MCP route contracts
components/ # Maintained React component behavior
lib/ # Auth, actions, queries, intake, routing, and SDK contracts
pages/ # Page-level rendering and authentication behavior
factories/ # Prisma-backed unique fixture builders
helpers/ # Next navigation and HTTP capture boundaries
proxy.test.tsWHERE TO LOOK
| Task | Location | Notes |
| Configuration | ../vitest.config.mjs | jsdom, serial execution |
| Navigation | helpers/nextNavigation.ts | next/navigation alias |
| DB fixtures | factories/prismaFactories.ts | Unique attributes |
| Collectors | api/ and lib/ | Accepted/rejected flows |
CONVENTIONS
- Use
// @vitest-environment nodefor server-only route, auth, or SDK tests; the default environment isjsdom. - Run deterministic checks with
docker compose -f docker-compose.yml --profile test run --rm test yarn test --run; the test service is one-shot and starts its dedicated database through the profile. - Keep tests under this tree rather than beside Next application source.
- Match the touched runtime boundary: route handlers under
api/, domain logic underlib/, components undercomponents/, and pages underpages/. - Prefer real
NextRequest, parser, generated client, or narrow collaborator calls at drift-prone boundaries. Mock database or external services only where the test's subject is the surrounding contract. - Factories must preserve uniqueness across the whole serial suite; continue using UUID-backed values for unique columns.
ANTI-PATTERNS
- Do not execute tests through
web; itsDATABASE_URLtargets development. - Do not rely on file concurrency or test order; shared database state has no global transaction/truncation harness.
- Do not test only accepted input when changing auth, origin/CORS, collector, MCP, payload-limit, or credential behavior.
- Do not assert redirect behavior by replacing the repository navigation helper with a one-off incompatible mock.
- Do not treat coverage inclusion as proof of behavioral coverage; there is no configured coverage threshold.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

