Skip to content

Commit 3cead33

Browse files
committed
Clarify when tests add value
1 parent 5808398 commit 3cead33

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

.codex/skills/writing-tests/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ Drive the code through its user-facing surface (`editor.copy()`, `editor.click()
1515

1616
Everything else here is a consequence of that rule.
1717

18+
## When not to add a test
19+
20+
Do not treat line coverage or "every changed file needs a test" as the goal. Add a test only when it protects an observable behavior, domain invariant, or public boundary that could regress independently of the implementation.
21+
22+
Skip a new test when it would only:
23+
24+
- repeat declarative framework wiring, dependency setup, or static configuration;
25+
- snapshot private query keys, option objects, CSS classes, component structure, or other implementation choices;
26+
- exercise a trivial delegation whose behavior is already covered at the owning boundary;
27+
- justify extracting a tiny helper solely so the implementation has something easy to unit-test;
28+
- assert behavior already guaranteed by TypeScript, Rust's type system, or the library being configured;
29+
- require mocks, spies, a parallel harness, or broad DOM/IPC infrastructure for code that is better verified by focused manual QA.
30+
31+
Examples: do not test that a `QueryClientProvider` is mounted, that a query key contains a particular string, or that a fixed-size chunk helper calls `slice()` correctly. Do test stable batching if it is exposed as a reusable contract with edge cases, or test the user-visible result through a real integration boundary when one exists.
32+
33+
When no worthwhile automated test exists, say so explicitly in the handoff and record the focused manual verification performed. Do not create a low-value test to make the diff look complete.
34+
1835
## If you're stuck, research — don't invent a mock
1936

2037
The moment you think "I'll just mock this out" is the moment to stop and look for prior art. Real Electron / font-editor / reactive-signal codebases have solved the same class of problem: VSCode, Obsidian, Signal Desktop, Bitwarden, Fontra, tldraw. Their patterns are on GitHub.

apps/desktop/src/renderer/src/lib/query/queryClient.test.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)