-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
looking to mock a function (foo) imported from a module (../foo), for example when using jest:
jest.mock('../foo'); // this happens automatically with automocking
const foo = require('../foo');
// foo is a mock function
foo.mockImplementation(() => 42);
foo();
// > 42see https://jestjs.io/docs/mock-functions#mock-implementations
I am doing this for an existing codebase that uses ts-mockito, so don't want to throw jest into the mix. :)
mrcrowl, mandriv, lehmann-dot-js, laithdhawahir, baphony and 2 more
Metadata
Metadata
Assignees
Labels
No labels