treq / test
AGENTS.md4 starsChanged 2 months agoApache-2.0View on GitHub
Setup lives in setup.common.ts (DOM polyfills, Tauri API stubs) and setup.integration.ts (NAPI dispatch). Factories are in factories/, UI library mocks in mocks/, render helpers in test-utils.tsx. Tests never run a real agent CLI. To start agent sessions with a working terminal, call installFakeAgents() from test/fake-agent.ts and restore it afterwards (try/finally or onTestFinished(installFakeAgents())).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- treq-dev/treqword for word, first seen Sep 28, 2026
Other versions1 project uses a version of this.
Word for word · 1
- treq-dev/treq★ 4100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
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,691 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 repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- src/AGENTS.mdAGENTS.md
- src-tauri/AGENTS.mdAGENTS.md
- app-qaSkill
- audit-interlinkingSkill
- docs-writingSkill
- explain-to-meSkill
- service-qaSkill
- ui-storySkill
- writingSkill
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Create a real jj repository via NAPI (createTestRepo)
- Very specific: line 39
Start every test from createTestRepo().
- Very specific: line 41
Use userEvent, never fireEvent
- Very specific: line 42
Prefer screen.findBy* over getBy* for elements that appear after Rust calls resolve
- Very specific: line 44
Keep beforeEach minimal; move complex repo setup into the test or a shared helper
- Distinctive: line 45
Never mock the Rust backend in integration tests.
- Very specific: line 46
Start every integration file with // @include-parallel or // @include-serial on its own line.
≈ “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
Frontend Test Guide
| Layer | Tool | Location |
| Unit | Vitest + React Testing Library | test/*.test.ts(x) |
| Integration | Vitest + RTL + real Rust via NAPI | test/integration/**/*.test.tsx |
Setup lives in setup.common.ts (DOM polyfills, Tauri API stubs) and setup.integration.ts (NAPI dispatch). Factories are in factories/, UI library mocks in mocks/, render helpers in test-utils.tsx.
Integration test pattern
- Create a real jj repository via NAPI (
createTestRepo) - Set the active repo URL param (
openRepo) - Render
<Dashboard />— Tauriinvokeis replaced with NAPI dispatch - Drive the UI via
userEvent - Assert DOM state
describe("workspace header", () => {
let user: ReturnType<typeof userEvent.setup>;
beforeEach(() => {
const { repoPath } = createTestRepo(false);
openRepo(repoPath);
user = userEvent.setup();
});
it("switches branch on click", async () => {
await createWorkspace(repoPath, "feat/thing");
render(<Dashboard />);
await user.click(await findSidebarBranchElement("feat/thing"));
expect(await screen.findByText("feat/thing")).toBeTruthy();
});
});Checklist
- Start every test from
createTestRepo(); never share repo state between tests - Render
<Dashboard />, not individual components, so the full provider tree runs - Use
userEvent, neverfireEvent - Prefer
screen.findBy*overgetBy*for elements that appear after Rust calls resolve - Assert visible text or ARIA roles, not internal state or which private functions ran
- Keep
beforeEachminimal; move complex repo setup into the test or a shared helper - Never mock the Rust backend in integration tests; use the real NAPI dispatch
- Start every integration file with
// @include-parallelor// @include-serialon its own line; the Vitest config reads it to pick the project, and a file without one runs serially. Use serial for files that edit the working copy and drive the Changes or Review views
Fake agent terminals
Tests never run a real agent CLI. To start agent sessions with a working terminal, call installFakeAgents() from test/fake-agent.ts and restore it afterwards (try/finally or onTestFinished(installFakeAgents())).
test/fake-agent/fake-agent.shstands in forclaude,codex,cursor-agentandcopilot. It printsfake-agent: <cli>,mode:,model:,session:,readyandprompt:lines, then echoes each typed line asreceived: <line>.- The helper sets
TREQ_TEST_PTY=1, so the backend spawns a real PTY without a TauriAppHandle. PTY output reaches the mockedlisten()throughtest/test-event-bus.ts, and xterm renders it, sowithin(pane).findByText("mode: plan")works. - Without the helper, PTYs do not spawn in tests (the previous behavior).
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.

