Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update diff to 1.0.7 and switch to the new WordsWithSpace diff algorithm #976

Merged
merged 1 commit into from
Sep 14, 2013

Conversation

papandreou
Copy link
Contributor

This makes differences in whitespace (eg. CRLF vs LF) show up in the string diffs.

Previously this test

it('should show whitespace differences', function () {
    var err = new Error();
    err.actual = "foo\r\nbar";
    err.expected = "foo\rbar";
    throw err;
});

would result in this output:

  1. should show whitespace differences:
    actual expected

foo<CR>bar

... which isn't really helpful. With this patch you'll get:

  1. should show whitespace differences:
    actual expected

foo<CR><CR><LF>
bar

The issue is that jsdiff's Words algorithm ignores whitespace differences. kpdecker/jsdiff#22 added a new mode that does what you want in a test framework, namely a word-based diff that doesn't ignore any differences when formatting the output.

…thm.

This makes differences in whitespace (eg. CRLF vs LF) show up in the string diffs.
travisjeffery pushed a commit that referenced this pull request Sep 14, 2013
Update diff to 1.0.7 and switch to the new WordsWithSpace diff algorithm
@travisjeffery travisjeffery merged commit fef52dc into mochajs:master Sep 14, 2013
@travisjeffery
Copy link
Contributor

Thanks

@spalger
Copy link

spalger commented Sep 14, 2013

Sweet, was just experiencing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants