marchaos / jest-mock-extended

Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended
MIT License
836 stars 57 forks source link

mockReset doesn't work well with calledWith #22

Closed regevbr closed 4 years ago

regevbr commented 4 years ago

When performing mockReset, the jest.fn() method is being reset which is great, but the inner state of the calledWith scope is maintained, thus the jest.fn() is not called again with mockImplementation and the call stack just gets piled up

regevbr commented 4 years ago

the fix is pretty easy, we need to check if the jest.fn() has an implementation, and if not, mock it and reset the stack. PR is coming soon