I am using Jest to mock certain functions from a module and to test in the following manner:
jest.mock("module", () => ({
funcOne: jest.fn(),
funcTwo: jest.fn(),
...
}));
import {funcOne, funcTwo, ...} from "module";
test("something when funcOne returns 'foo'", () => {
funcOne.mockImplementation(() => 'foo'); // <- Flow error
expect(...)
});
test("that same thing when funcOne returns 'bar'", () => {
funcOne.mockImplementation(() => 'bar'); // <- Flow error
expect(...)
});
How can I stop Flow from reporting a property 'mockImplementation' not found in statics of function error without error suppression (e.g. $FlowFixMe)?
I understand that the issue comes from the fact that the functions defined in the module are not Jest-mocked functions and, as far as Flow is concerned, do not contain methods like mockImplementation, mockReset, etc.