Closed roobie closed 4 years ago
I am willing to improve the patch if you have any suggestions? I think it could be nice if it was possible to "stream" results to a plugin. I.e. for each assert, there could be a callback invoked or something.
@roobie This is awesome! Thanks so much for submitting the PR :D I made some minor changes to make the style consistent with the remainder of the code. Let me know what you think!
@roobie Streaming results could be interesting. Would your idea be to add a variable that would be called instead of compose-and-record-result
(but with that set as the default)? Similar to how the report printer works. Or would there need to be broader architectural changes?
:+1: Looks much better now! Sorry for being sloppy :) - I'll do better next time. I think your idea about making the compose-and-record-result
configurable will cover the use case. If you don't mind, I'll take a stab at making it so and also implement a TAP-style printer.
Actually, having taken a closer look, I don't think we need to make the compose-and-record-result
configurable, but instead we can have a (var- compose-and-record-result-hook)
-function that can be set, and in the compose-and-record-result
we call the hook, if set to a function. By doing that, testament
can still track the results and without too big of a change.
@roobie Oh nice idea! I'll merge this now but please feel free to add that as a separate PR :)
The built-in default is used if none is explicitly configured.
The reason for this is to be able to produce e.g. TAP output so the library theoretically can be used with existing pretty printers.