Jest
Recipes that cleanup Jest code.
Recipes
- Disallow Jasmine globals
- Disallow alias methods
- Disallow use of deprecated functions from before version 27
- Disallow using jest.mock() factories without an explicit type parameter
- Enforce lowercase test names
- Enforce test and it usage conventions
- Enforce valid titles
- Prefer await expect(...).resolves over expect(await ...) syntax
- Prefer mock resolved/rejected shorthands for promises
- Recommended Jest code cleanup
- Require using .only and .skip over f and x
- Suggest using jest.spyOn()
- Suggest using test.todo
- Suggest using the built-in comparison matchers
- Suggest using toBe() for primitive literals
- Suggest using toContain()
- Suggest using toHaveLength()