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

Problems I've encountered #4

Open
leonheess opened this issue Sep 12, 2022 · 2 comments
Open

Problems I've encountered #4

leonheess opened this issue Sep 12, 2022 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@leonheess
Copy link

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:

  • global.d.ts doesn't work, IDE complains that fetch doesn't have this function
  • returning Promise.reject inside mockResponse does not result in a failed request it just returns the content but res.ok is still true
@IanVS
Copy link
Owner

IanVS commented Sep 12, 2022

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?

@IanVS IanVS added bug Something isn't working help wanted Extra attention is needed labels Sep 12, 2022
@kin-nex
Copy link

kin-nex commented Sep 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants