fetch-mock icon indicating copy to clipboard operation
fetch-mock copied to clipboard

Inconsistent fallback [to network] logging and behaviour

Open wheresrhys opened this issue 4 years ago • 1 comments

As exemplified by this table

approach result appliedLast
catch() call logged as unmatched: true yes
catch(response) call logged as unmatched: true yes
fallbackToNetwork: true call logged as unmatched: true yes
fallbackToNetwork: 'always' call not logged kinda no... clobbers everything
spy() call logged as unmatched: true yes
spy(route) call logged as unmatched: false no
mock('*', 200) call logged as unmatched: false no
mock({}, 200) call logged as unmatched: false no

The behaviour of spy() vs spy(route) is particularly egregious, but the whole APIs behaviour has been built up gradually without a masterplan. The next major version should sort it out

wheresrhys avatar May 25 '20 20:05 wheresrhys

Would particularly love if you could call catch at any time (not needing to be last) and have it take effect, e.g. in a global beforeEach().

timkindberg avatar Jun 25 '21 20:06 timkindberg