Skip to content

detect untyped mocks #779

@feloy

Description

@feloy

Hello, I would like to know if it is possible to detect with the rules of this module, or with any other rule, if untyped mocks are used. For example:

const addMock = vi.fn();
const dependencyMock = {
  add: addMock,
} as Dependency;
addMock.mockReturnValue(true);
const myTestedObject = new TestedObject(dependencyMock);
myTestedObject.init();
// init calls `add` from `addMock`
expect(addMock).toHaveBeenCalled();

In this example, addMock.mockReturnValue accepts a parameter with type any, and expect accepts a parameter with type Mock<Procedure>. I would like to detect these generic types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions