Switching between character/line diff?
mindplay-dk opened this issue · comments
In the diff reporter, can we have some means of switching between diffChars
and diffLines
?
diffChars
works well for individual strings, but doesn't work so well for multi-line content.
(This is also (presumably) why diffJson
internally uses the lineDiff
tokenizer.)
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.
That sounds like a good idea