The simplest option, I think, would be to have diffStrings check for line-breaks in expected - if line-breaks are present, use diffLines instead of diffChars, which would give an output more similar to that of diffObjects.
Perhaps better, if expected contains line-breaks, to do both a line diff and a character diff, and see which one yields the fewest results - and then render that as the result.
For me, personally, the simplest option would work: just treat multi-line strings as lines.
In the diff reporter, can we have some means of switching between
diffChars
anddiffLines
?diffChars
works well for individual strings, but doesn't work so well for multi-line content.(This is also (presumably) why
diffJson
internally uses thelineDiff
tokenizer.)The simplest option, I think, would be to have
diffStrings
check for line-breaks inexpected
- if line-breaks are present, usediffLines
instead ofdiffChars
, which would give an output more similar to that ofdiffObjects
.Perhaps better, if
expected
contains line-breaks, to do both a line diff and a character diff, and see which one yields the fewest results - and then render that as the result.For me, personally, the simplest option would work: just treat multi-line strings as lines.