Require exact assertions instead of substring checks in tests (agent guidelines)
Merged
FA
17h ago+4+4+0123456789-0-0-0123456789
Type of change
- This change requires a documentation update (agent guidelines only)
Description
Adds rules to the Testing section of AGENTS.md (symlinked as CLAUDE.md):
- Assert exact values, never substrings. Every error message, warning, or produced output (rendered code, compiled JS, CLI output) a test checks must be compared in full against the complete expected value. Checking that a fragment appears somewhere inside it, including through a partial regex match, is not allowed: a substring check still passes when the output around it is wrong, so regressions slip through.
- Run-dependent parts (temp paths, hashes, addresses, timestamps) are handled by deriving the expected value from the same inputs or normalizing those parts to fixed placeholders, then comparing the whole value.
- Existing tests still contain substring checks; new assertions must not copy that pattern.
- Prefer a few thorough tests that pin down exact behavior over many shallow ones.
The rules describe what tests must do rather than prescribing specific assertion code.
This only changes contributor and agent guidance; no package source is touched, so no news fragment is needed (skip-changelog).