IanVS / vitest-fetch-mock

Vitest mock for fetch, forked from jest-fetch-mock
MIT License
59 stars 7 forks source link

Problems I've encountered #4

Open leonheess opened 2 years ago

leonheess commented 2 years ago

First of all, thank you so much for writing this, it is amazing. However, I'm having trouble getting it to work exactly how I want. Here are some of the Issues:

IanVS commented 2 years ago

I'm honestly not too familiar with this project, I mostly just adjusted it to work with vitest. I'd be happy to review a pull request though if you or someone else can solve the issues. You could check if https://github.com/jefflau/jest-fetch-mock has the issues as well, and maybe an issue is open there?

kin-nex commented 1 year ago

Just started looking into this package so bare with me here:

@leonheess I believe the issue here is that you can configure Jest to be smart enough that you can use fetch in your tests buit it's actually calling the declared const fetchMock (see their docs here).

I don't believe such an option exists on Vitest's config currently so for now you if you use fetchMock in your tests you'll get the same result.