Open rnphilp opened 3 years ago
Hi @rnphilp, thanks for raising this! Would you mind recreating this with our recreation template, so we can see exactly which output is too verbose?
For context, some of the error output comes from our validation dependency, but we are the ones deciding to output the whole response body, to aid debugging (but in this case it can be improved).
Just as a note - if our output overruns the history limit of the terminal because many tests are failing their toSatifyApiSpec()
assertions, I'd suggest running and fixing those tests one by one.
Thanks for bringing this to our attention 🙂
OpenAPI version 3
Is your feature request related to a problem? Please describe. When using the toSatisfyApiSpec function, the output often overruns the history limit of the terminal. This is the case when the API route being tested returns an array of items (even if only one of the objects in the whole array is invalid), or when running a full test suite, where there are multiple errors returned. The output of the body response can be too large, making it difficult/impossible to navigate to the actual issues, when the key information is just the initial message at the top.
Describe the solution you'd like An options object that passed into the function allowing you to suppress certain sections of the output. Something like:
Everything can be true by default to avoid changing the current functionality.
Describe alternatives you've considered Reducing the request body logs to remove the valid items in the array and only include the errors. So the output would be more like:
Or just displaying a reduced snapshot of that section of the body, with say 5 lines above and below.
Additional context No
Are you going to resolve the issue? Not currently got the opportunity.