grug / data-mocks

Library to mock local data requests using Fetch or XHR
MIT License
63 stars 12 forks source link

Allow to control fetch-mock 'warnOnFallback' API via MockConfig #54

Closed JabbyPanda closed 4 years ago

JabbyPanda commented 4 years ago

Is your feature request related to a problem? Please describe. Would like to disable fetch-mock warnings in console

Describe the solution you'd like

const mockConfig = {
 allowXHRPassthrough: true, 
 allowFetchPassthrough: true,
 warnOnFallback: false,
}

injectMocks(scenarios, 'default', mockConfig);

Describe alternatives you've considered

Probably this API can be set directly on FetchMock, which is not that convenient

import * as FetchMock from 'fetch-mock';
FetchMock.config.warnOnFallback = false;
grug commented 4 years ago

Hey @JabbyPanda thanks for the feature request :)

This definitely makes sense to do. I'll try to get something sorted in the short-term and will do a better implementation once I've updated fetch-mock for the project (I'm years behind 😂).

Let me know if you have any other feedback/suggestions about the library - always love it :)

-Dave

JabbyPanda commented 4 years ago

Thank you for a prompt library update, much appreciated

grug commented 4 years ago

No worries :)