<@UVAR0DXP0> what do you think about <https://gith...
# kotest-contributors
s
@Emil Kantis what do you think about https://github.com/kotest/kotest/issues/2541
e
I think we have that to some extent? Do you have a particular case we can look at? 🙂
Or do we just show the first property that failed?
s
We currently show expected was .... actual was .... but for large json its really difficult to see where they differ
maybe we keep that and yeah show the first property (or few) that failed along with the json path to them ?
that would be sweet
e
I’ll have a look 🙂
s
cool
j
Could we build a git style diff?
s
With the + -
e
Isn't that kind of what IntelliJ already produces from the "expected was...", "actual was..."?
at least if we do it with the
expected was <[ { ... }]>, actual was <[ { ... }]>
format? 🤔
s
it won't be as clear tho
like if a field was missing
but certainly better
we could do both
e
I guess it gets complicated when not being strict in every regard.. e.g. allowing different number formats, type coercion, etc.. then diffs will pop up that don't actually matter as well
I'll start with the property-printing with json-paths you suggested, and then we can go for another round of feedback once I'm a bit more up-to-speed on it?
s
sure
e
We currently show expected was .... actual was .... but for large json its really difficult to see where they differ (edited)
Was this when using
shouldMatchJson
or
shouldEqualJson
, (or their underlying matchers)? just asking since i saw you used
matchJson
in your PR which would not print any help other than expected vs actual
Example test of `equalJson`: shows path to a missing field, for instance
Copy code
test("real world json without field") {
         val a = this::class.java.getResourceAsStream("/shopify.json").bufferedReader().readText()
         val b = this::class.java.getResourceAsStream("/shopify_without_field.json").bufferedReader().readText()
         shouldFail {
            a shouldEqualJson b
         }.message.shouldStartWith(
            """At 'products.[0].variants.[0]' object was missing expected field(s) [sku]
s
we should overly format these in my opinion
I'd like to see our error messages in 5.1 go on acid
😄 1
e
gotcha 👌