error-handling-test
Installation
SKILL.md
Error Handling Test Skill
Discovery
Before writing any tests, scan the target code for:
- Explicit throws —
throw new Error(...), custom error classes, re-throws - Implicit throws — array/object destructuring on null, property access on undefined, calling non-functions
- Async failure surfaces —
Promise.reject,asyncfunctions thatthrow, unhandled branches in.then()chains - Fallbacks — default values, catch blocks that return something, optional chaining with fallback (
?? default), try/catch that swallows errors silently - Error propagation — does the function rethrow, wrap, or consume the error? Each behavior needs a different assertion
Non-Obvious Patterns to Cover
1. Assert the error type and message, not just that something throws
// WEAK — only verifies something threw
expect(() => fn()).toThrow();