Skip to content

HTML Reporter: Show diff only when it helps#786

Closed
shivamdixit wants to merge 1 commit into
qunitjs:masterfrom
shivamdixit:335-show-diff-only-when-it-helps
Closed

HTML Reporter: Show diff only when it helps#786
shivamdixit wants to merge 1 commit into
qunitjs:masterfrom
shivamdixit:335-show-diff-only-when-it-helps

Conversation

@shivamdixit

Copy link
Copy Markdown
Contributor

Don't show diff if expected and actual values are completely different and there is nothing in common.

However when working with two different arrays or objects, the braces remains common because of which the length changes and diff is displayed. Is this behavior accepted? It works fine if we compare object and array. Screenshot attached:

qunit

Fixes #335

Don't show diff if expected and actual values are completely different
and there is nothing in common

Fixes qunitjs#335
@jzaefferer

Copy link
Copy Markdown
Member

This is also something I'd like to evaluate after we've landed a new diff implementation (#772), since that is very likely to affect this optimization.

leobalter pushed a commit that referenced this pull request Mar 26, 2015
@shivamdixit

Copy link
Copy Markdown
Contributor Author

Output with new diff library (Google diff patch match):

qunit6

I think this PR is still valid. In case of completely different output no diff is displayed. However even if one character is same, diff is displayed.

What do you think @jzaefferer ?

@leobalter

Copy link
Copy Markdown
Member

There's only one thing missing here, maybe introduced by the recent changes: we need to check and ommit the diff when one of the values (actual or expected) is a boolean.

The diff: falstrue is awful.

@shivamdixit

Copy link
Copy Markdown
Contributor Author

@leobalter Yes, I agree. Showing diff for boolean don't make much sense.

@leobalter

Copy link
Copy Markdown
Member

https://github.com/jquery/qunit/compare/master...leobalter:shivamdixit-335-show-diff-only-when-it-helps?expand=1

I've got that branch rebased and did the other commit checking the boolean value.

@shivamdixit

Copy link
Copy Markdown
Contributor Author

Looks good to me. Created a new PR. Ref #802

@leobalter

Copy link
Copy Markdown
Member

You could have updated your branch, but let's move on the new PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Show diff only when it helps

4 participants