Skip to content

Files

Latest commit

 

History

History
24 lines (18 loc) · 495 Bytes

no-restricted-jest-methods.md

File metadata and controls

24 lines (18 loc) · 495 Bytes

Pattern: Use of restricted Jest method

Issue: -

Description

Some Jest methods may be restricted in a project to enforce consistent testing patterns or avoid problematic testing practices.

Examples

Example of incorrect code:

jest.useFakeTimers();
jest.spyOn(video, "play");
jest.advanceTimersByTime(1000);

Example of correct code:

// Use allowed methods based on project configuration
jest.fn();
expect.any(Number);
await waitFor(() => {});