Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@fetch-mock/vitest error: Cannot read properties of undefined (reading 'callHistory') #874

Open
prescottprue opened this issue Nov 14, 2024 · 2 comments
Labels

Comments

@prescottprue
Copy link

prescottprue commented Nov 14, 2024

Setup @fetch-mock/vitest as per documentation and I have two issues:

  1. Types aren't being loaded when using TS, resulting in Property 'toHavePatched' does not exist on type 'Assertion<FetchMockVitest>' - I didn't see anything in the docs about needing to do a manual override of Vitest types (as described in the Vitest expect extend docs)
  2. toHavePatched seems to be throwing Cannot read properties of undefined (reading 'callHistory'):
expect(fetchMock).toHavePatched({})

I'll create a repo for reproducing this tomorrow (didn't want to forget to call it out), but I haven't gotten it to work at all yet, so should be pretty easy to reproduce - or maybe I'm missing something?

@wheresrhys
Copy link
Owner

Thanks - a repo would be great, and I'l take a look in the next few days

@gonzalovilaseca
Copy link

Same happens with Jest by the way

@wheresrhys wheresrhys added the bug label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants