fetch-mock
fetch-mock copied to clipboard
Error Message always the same, even though could be determined what is wrong.
When writing tests and i Provide the wrong body or url in fetch mock the error-message is always the same =>
Error: fetch-mock: No response or fallback rule to cover put to {url}
one could determine if the body or the url is wrong.
Can i implement this?
Kind Regards
Kilian
Are you suggesting adding more debug info to the error log, essentially describing in more detail the request which has not been matched?
yes. that would be the proposal. I would give more Debug Info if the body or the url was not matched.
Just open a pull request for this?
I'm not sure about it as a feature.
- The error state only covers a small number of situations where mocks are misconfigured e.g. misconfigured mocks can result in the wrong mock being applied, rather than no mock.
- I used to have debug messages dotted all over the library but they added complexity to the code base and were less helpful than just using node's debugging tools to step through code when something unexpected happens
Given that your proposal would only cover one out of many scenarios when things can go wrong, and node has good tools to allow pausing code execution to inspect the values, I think I will leave things as they are.
I'm happy to leave the issue open for a while though to see if anybody else votes for the feature
Closing due to inactivity