You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
After upgrading our codebase to jest 26 and this library to 1.5.1, our tests that used the .toHaveBeenCalled assertions stopped working. It appears that the .mock property is never updated with the calls to the spy.
I tried digging into the code a bit, and it seems like this wrapper does the Object.assign(jestifiedInstance.mock, spy.mock) only once, so those aren't kept in sync. Unfortunately fetchMock.mock is also a method, so we can't just assign jestifiedInstance.mock = spy.mock.
I tinkered around with the code locally and got something working by handling the fetchHandler and mock inside the proxy. It seems to run on our codebase without issue. I'd be happy to spin up a PR if you're interested!
The text was updated successfully, but these errors were encountered:
Just to add onto the content above, I'm having the exact same issue... I have clearMocks enabled in my Jest config and I spent the last two hours debugging this:
After upgrading our codebase to jest 26 and this library to 1.5.1, our tests that used the
.toHaveBeenCalled
assertions stopped working. It appears that the.mock
property is never updated with the calls to the spy.I tried digging into the code a bit, and it seems like this wrapper does the
Object.assign(jestifiedInstance.mock, spy.mock)
only once, so those aren't kept in sync. UnfortunatelyfetchMock.mock
is also a method, so we can't just assignjestifiedInstance.mock = spy.mock
.I tinkered around with the code locally and got something working by handling the
fetchHandler
andmock
inside the proxy. It seems to run on our codebase without issue. I'd be happy to spin up a PR if you're interested!The text was updated successfully, but these errors were encountered: