Allow custom ResultWriter implementation #296
sergeidyga
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I need to create a custom
ResultWriter
implementation to output assertion subjects as JSON strings (ideally, enriching the ouput with pointers to the failed properties). However, the current library architecture poses challenges for achieving this. While there are existingResultWriter
implementations likeAnsiColorResultWriter
andMarkdownResultWriter
, they are not directly usable due to visibility and usage restrictions.The problem lies in the fact that
ResultWriter
is internally defined within theAssertionStrategy class
, but it's not part of its constructor. Additionally,AssertionStrategy
is part of theAssertionBuilder class
constructor, but that does not help sinceAssertionBuilder
is also an internal class.This design makes it difficult to extend
ResultWriter
functionality without creating custom versions of bothAssertionBuilder
andAssertionStrategy
, which is a substantial task.I seek guidance on the best approach to tackle this issue. Specifically, I'm interested in contributing to make the
ResultWriter
customizable. This enhancement could benefit both my use case and the wider user community facing similar needs.Thank you for your assistance :)
Best regards,
Sergei
Beta Was this translation helpful? Give feedback.
All reactions