Add custom message to Jest expects
Overall
score
99%
{
"context": "This criteria evaluates how effectively an engineer uses jest-expect-message to add custom error messages to Jest assertions, specifically testing their understanding of the proxy-based matcher interception pattern that enhances error messages without modifying Jest's original behavior.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses expect with message parameter",
"description": "Uses the jest-expect-message syntax correctly by calling expect() with two parameters: expect(actual, message).matcher() where the second parameter is the custom error message",
"max_score": 30
},
{
"name": "Custom messages are descriptive",
"description": "Provides clear, meaningful custom error messages that describe what is being validated (e.g., 'User age must be at least 18' rather than generic messages)",
"max_score": 15
},
{
"name": "Works with standard matchers",
"description": "Correctly uses jest-expect-message with standard Jest matchers such as toBe(), toEqual(), toBeGreaterThan(), or toMatch()",
"max_score": 20
},
{
"name": "Handles negation with .not",
"description": "Successfully uses custom messages with negated assertions using the .not modifier (e.g., expect(value, message).not.toBe())",
"max_score": 15
},
{
"name": "Tests cover all scenarios",
"description": "Implements all four required test scenarios: age validation, username validation, email validation, and user status validation",
"max_score": 15
},
{
"name": "Proper test structure",
"description": "Organizes tests properly using describe() and test() blocks with meaningful test names",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-jest-expect-messagedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10