-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Show diff only when it helps #802
Show diff only when it helps #802
Conversation
Don't show diff if expected and actual values are completely different and there is nothing in common Fixes qunitjs#335
Note: this is a follow up to #786 and also address an issue introduced on the last changes showing a whacky |
Seems like the test timed out. |
it worked now |
Ping. |
The hack to show true/false differently is bad. This is likely to blow up with a similar combination of single word pairs, or maybe with numbers. We want to character-by-character diff for syntax, but maybe not for literals like booleans? Since we already landed the new diff, can we keep the "show diff only when it helps" and "show better diff for booleans" apart? |
the regexp works only for Booleans, as strings are represented between double quotes and the regexp will search from the start to the end of the value: |
btw, |
as told on the biweekly meeting, the boolean regexp check is good as-is and @jzaefferer agreed to land it. |
Great. So this PR is ready to be merged? |
LGTM, I'll just wait for @jzaefferer 👍 here to confirm. Then I'll squash the commits and merge them. |
expected.indexOf( "[object Object]" ) !== -1 ) { | ||
message += "<tr class='test-message'><th>Message: </th><td>" + | ||
"Diff suppressed as the depth of object is more than current max depth (" + | ||
QUnit.config.maxDepth + ").<p>Hint: Use <code>QUnit.dump.maxDepth</code> to " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the <code>QUnit.dump.maxDepth</code>
to use QUnit.config.maxDepth
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried to change it to QUnit.config.maxDepth
but strangely it din't work, whereas using QUnit.dump.maxDepth
works fine. I guess this is happening because dump.maxDepth
is initialized with default config.maxDepth
in file dump.js
and then the value of config.maxDepth
is changed. Hence I got a message which looks like:
Diff suppressed as the depth of object is more than current max depth (infinity)
However specifying maxDepth
in GET parameters works fine because if parameters are present, the value of config.maxDepth
is updated in file core.js
before initialization in dump.js
.
Noticed two things, not sure why I missed them before. |
Squashed the two commits into one and merged. Thanks again! |
Follow up of #786