jest-fetch-mock
jest-fetch-mock copied to clipboard
jest.setMock not needed in enableMocks
I believe the jest.setMock(..)
call on this line is not needed:
https://github.com/jefflau/jest-fetch-mock/blob/master/src/index.js#L240
Due to the way jest mocking works (which is super unclear to me) we can't setup a mock from within a module.
The fetch mock still works because fetch
isn't require'd and instead global.
I was able to remove the setMock statement in a test setup and fill it with garbage, and the sample tests still work.
I definitely could be mistaken, like I said I basically have no idea how jest mocks are scoped
@yinzara Can you take a look at this if you have time?