axios-mock-adapter
axios-mock-adapter copied to clipboard
Enhancement Request: onNoMatch function callback
Hello, I'm wondering if you'd accept a PR to add the ability for the onNoMatch option to accept a function callback.
This could be very helpful for making integrations with test frameworks.
For example, if I am writing a vitest test and I want to raise a test error that fails the suite given some http requests are not mocked.
const axiosMock = new AxiosMockAdapter(myAxiosInstance,
{ onNoMatch: (request) => expect.fail("Unexpectedly received unhandled http ${request.verb} request: ${request.url}") }
)
I'm willing to put in the legwork for my use case, just let me know if this work would be accepted, thanks!