Added variant of WordDiff that doesn't ignore whitespace differences #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now mocha uses the
DiffWords
algorithm to back its string diffs feature: http://tjholowaychuk.com/post/18574009869/mocha-string-diffsHowever, the fact that
DiffWords
ignores whitespace differences makes it extremely hard to debug problems with differences in eg. line endings:... because that makes the test framework render the text without any added/removed text highlighted.
DiffChar
doesn't suffer from this problem, but for long texts it's very hard to make sense of a char-based diff, so there's a use case for a mode that diffs word-by-word, but doesn't ignore whitespace differences. Turns out that was extremely easy to achieve, so this PR gives you:Seems like vows has the same issue: vowsjs/vows#281