Replace specific module in testing
问题 I am testing my React-Redux app with Jest and as part of this in my API calls I am importing a fetch module cross-fetch . I want to override or replace this with fetch-mock . Here is my file structure: Action.js import fetch from 'cross-fetch'; export const apiCall = () => { return fetch('http://url'); Action.test.js import fetchMock from 'fetch-mock'; import { apiCall } from './Action'; fetchMock.get('*', { hello: 'world' }); describe('actions', () => { apiCall().then( response => { console