I use Jest to test the REST API, and I get a TypeError: requests with network failures are requested whenever I issue a fetch request. All REST API calls work on the application and fail solely on my Jest tests.
Are there any known incompatibilities between fetch and Jest? For example, this simple test ends with a catch statement:
it('should find a result via fetch', () => { fetch('http://www.google.com').then(() => console.log('Success')).catch((err) => console.log('Error!!!!' + err)); });
The result: Error !!!! TypeError: network request failed
source share