question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Replace our fetch and Response mocking with fetch-mock-jest

See original GitHub issue

We have some places where we mock fetch and Response and this is easily messy. Instead we should use fetch-mock-jest

Use git grep '\.fetch' src/test/ to see all usages. It’s probably possible to migrate step by step, with several PRs.

Step 1: install and set up the package Step 2: use it in test files. This could be split in different PRs for an easier review.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
julienwcommented, Jan 4, 2022

hey @ryotabs, sure! Please report your progress within 1 week so that we know you’re still working on this. Thanks!

0reactions
julienwcommented, Apr 13, 2022

I updated the description to reflect the current work needed here. Indeed thanks to the work of @ryotabs we identified another npm package that we’d like to use, different than the one we considered initially.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Mock Fetch in Jest | Leigh Halliday
One option when manually mocking a module is to create a folder named __mocks__ and place a file in it with the same...
Read more >
jefflau/jest-fetch-mock - GitHub
Jest Fetch Mock allows you to easily mock your fetch calls and return the response you need to fake the HTTP requests. It's...
Read more >
How to mock fetch calls with jest | Medium | Fernando Ferreira
The solution is to use jest to mock the fetch function globally. ... any following calls will return the default mocked response.
Read more >
Mocking Fetch Using jest-fetch-mock - YouTube
This video focuses on testing a function which makes a fetch call, mocking fetch using the jest - fetch - mock package rather...
Read more >
A Beginners Guide to Learn Mock Fetching in jest - HackerNoon
I am writing this post to show how to mock and test fetch with jest-fetch-mock. let's suppose that you are using Jest and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found