Skip to content

docs(claude): add rule T008 for custom matcher usage in tests#316

Merged
couimet merged 1 commit intomainfrom
side-quest/claude-md-t008-custom-matchers-rule
Feb 7, 2026
Merged

docs(claude): add rule T008 for custom matcher usage in tests#316
couimet merged 1 commit intomainfrom
side-quest/claude-md-t008-custom-matchers-rule

Conversation

@couimet
Copy link
Owner

@couimet couimet commented Feb 7, 2026

Repeated corrections during #255 PR5 review showed that manual Result unwrapping and missing toStrictEqual in callbacks were a recurring pattern. Codifying as a rule prevents future sessions from repeating these mistakes.

Benefits:

  • Documents all 6 available custom matchers in one place
  • Enforces toStrictEqual on full value object inside toBeOkWith callbacks
  • Bad/good examples make the expected pattern unambiguous

Summary by CodeRabbit

  • Documentation
    • Introduced critical coding rule T008 for asserting Results and error handling in tests. The rule provides guidance on recommended custom matchers, disallowed patterns to avoid, and practical examples for testing both success and failure scenarios.

Repeated corrections during #255 PR5 review showed that manual Result unwrapping
and missing toStrictEqual in callbacks were a recurring pattern. Codifying as a rule
prevents future sessions from repeating these mistakes.

Benefits:
- Documents all 6 available custom matchers in one place
- Enforces toStrictEqual on full value object inside toBeOkWith callbacks
- Bad/good examples make the expected pattern unambiguous
@coderabbitai
Copy link

coderabbitai bot commented Feb 7, 2026

Walkthrough

A new rule T008 is added to CLAUDE.md providing guidance on using custom matchers for Result and error assertions. The rule includes preferred matcher recommendations, disallowed patterns, available matchers, and examples demonstrating both error and success assertion paths.

Changes

Cohort / File(s) Summary
Testing Rule Documentation
CLAUDE.md
Added rule T008 covering custom matchers for Result and error assertions, including preferred matchers (toBeRangeLinkExtensionErrorErr, toBeOkWith, toStrictEqual), disallowed patterns (manual unwrap), and bad/good examples. Rule appears duplicated in document.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A new rule hops into place,
T008 brings testing grace,
Custom matchers light the way,
No manual unwraps today!
Results asserted, errors caught,
Better tests than code has wrought! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a documentation rule T008 about custom matcher usage in tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch side-quest/claude-md-t008-custom-matchers-rule

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@couimet couimet merged commit c49b507 into main Feb 7, 2026
2 checks passed
@couimet couimet deleted the side-quest/claude-md-t008-custom-matchers-rule branch February 7, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant