Parameterised tests for Jest that enable running the same test multiple times with different data sets using arrays or tagged template literals
85
{
"context": "This criteria evaluates how well the engineer uses Jest's module mocking system to automatically mock modules and track method invocations. The focus is on proper usage of jest.mock(), accessing mock metadata, and managing mock state.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses jest.mock()",
"description": "Uses jest.mock() to automatically mock the external module at the top of the test file or within the implementation",
"max_score": 25
},
{
"name": "Accesses mocked module",
"description": "Correctly imports and accesses the mocked module after calling jest.mock(), ensuring all exported functions are mock functions",
"max_score": 15
},
{
"name": "Tracks call arguments",
"description": "Uses mock.calls or toHaveBeenCalledWith() to access and verify the arguments passed to mocked methods",
"max_score": 20
},
{
"name": "Checks call count",
"description": "Uses mock.calls.length or toHaveBeenCalledTimes() to verify the number of times a method was called",
"max_score": 15
},
{
"name": "Accesses call history",
"description": "Retrieves complete call history using the mock.calls property or mock.mock.calls to access all invocations with their arguments",
"max_score": 15
},
{
"name": "Clears mock state",
"description": "Uses mockClear(), mockReset(), or jest.clearAllMocks() to reset mock call history between tests",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-jest-eachdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10