Closed rafaelcaviquioli closed 4 years ago
Any chance we're merging this soon?
Please merge this.
Thanks!
Did the types not get updated when this was merged?
need onNoMatch?: 'passthrough' | 'throwException';
the interface on master has,
interface MockAdapterOptions {
delayResponse?: number;
onNoMatch?: 'passthrough';
}
This submission allows the new option
throwException
inonNoMatch
instance configuration.Current problem: When a request has no configured mock, is not possible to trace and identify the source of request.
This is the only one feedback received from axios-mock-adapter:
Proposed solution Using
onNoMatch
option withthrowException
to throw an exception with details about request url and method when a request is made without match any handler.This is the new console output:
I believe this new option is helpful for developers who are working with a lot of mocks. Sometimes we forget to define a required mock or do mistakes when setup it. When it happens, is not possible to trace and identify the source of request.
The same need was mentioned in issue https://github.com/ctimmerm/axios-mock-adapter/issues/173 by @createthis