fetch-mock
fetch-mock copied to clipboard
Inconsistent fallback [to network] logging and behaviour
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
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()
.