-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Explain diff gutter symbols #1558
Comments
The idea is that the new value should be adjusted to match the old value. If you'd used
What is definitely wrong though is that the colors are not inverted the way the gutters are. I've just opened concordancejs/concordance#40 for that. If that were fixed would you be happy with the current behavior? |
Well, the colors are the primary indicator for me, but I am so used to the
patch view that reversing the order is odd to me, `-` means "previous", not
"wrong value that you should fix".
…On Mon, Oct 23, 2017, 4:50 PM Mark Wubben ***@***.***> wrote:
The idea is that the new value should be adjusted to match the old value.
If you'd used t.is():
direct diff
/private/var/folders/2_/qczp184x76b2nl034sq5hvxw0000gn/T/tmp.dcvW5BUyA5/test.js:8
7: test('direct diff', t => {
8: t.is(`\n${Date.now() - 42e5}\n`, `\n${Date.now()}\n`)
9: })
Difference:
`␊
- 1508765718717␊
+ 1508769918717␊
`
What is definitely wrong though is that the colors are not inverted the
way the gutters are. I've just opened concordancejs/concordance#40
<concordancejs/concordance#40> for that.
If that were fixed would you be happy with the current behavior?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1558 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADWlqOsoB5v_2zAw7RumpYqfpqOobomks5svKe0gaJpZM4QAMuE>
.
|
In the The Just like a code patch in a bugfix takes you from a "bad" file to a "good" file, so would "applying" the diff in AVA's output help you make the actual value match the expectation. I think that holds for snapshots, too. |
I have to agree with @wmertens, this is counter intuitive. Reason being that Ava has this nifty feature But that's just my opinion. Edit: Looking at the jest snapshot testing documentation it seems they're using a compromise:
They also explicitly state which is which to avoid any confusion. |
@nesbocaj so if I'm interpreting this right, we'd keep the |
@novemberborn I'm having a hard time figuring out what the current order of the values are, so just to avoid any confusion I'm gonna lay it out below: - the snapshot value, colored in green Doing it this way will make Ava more approachable to developers coming from Jest and vice versa, as well as work towards establishing some kind of standard in the matter. |
@novemberborn It is worth noting however that this way of doing it is still different from what most developers will be familiar with from eg. git diffs: - the snapshot value
+ the new (updated) value So I think it would be beneficial to have some kind of introduction to the diff syntax, akin to how Jest does it: Of course the lines
do take up quite a bit of screen real estate and it's up to the Ava developers as to whether or not they want to make this compromise. |
@novemberborn any update on this? I have been tripped up by the I think what @nesbocaj said makes sense. For me the colors are not as important as the |
Yes, the way Jest does it looks good!
…On Thu, Mar 1, 2018 at 12:53 PM rzec-r7 ***@***.***> wrote:
@novemberborn <https://github.com/novemberborn> any update on this? I
have been tripped up by the + / - difference with AVA so many times.
I think what @nesbocaj <https://github.com/nesbocaj> said makes sense.
For me the colors are not as important as the - / + and since snapshots
are tests that are just diffing 2 values, it make the most sense to have
the - be the existing value in the snapshot and the + be the new value
from the test (I have not opinion on the colors, probably makes to to just
match what jest does).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1558 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADWlhVQfoQ2qiR_dK-UIn26li2_F1Wlks5tZ-FSgaJpZM4QAMuE>
.
|
Does Jest "explain" the - and + in each diff or once per output? |
Git and markdown ```diff ...``` shows new changes with green + and deleted with red - |
@arteniioleg Jest should only be confusing if you assume the colors have the same purpose, they don't. In both instances the preceding symbol signifies changes, with It's also worth noting that Jest goes quite far in explaining (or at least trying to explain) this concept to the user. |
Not 100% relating, but I just spent so much time looking into my Unit Tests because I didn't realize what each symbol stood for in this output for a
Why don't we add a simple
below? Only the symbols are not completely intuitive to me. |
Let's start with adding In essence, this line should track whether the diff comes from Then the message can be added here: |
@IssueHunt has funded $60.00 to this issue.
|
I submitted a pull request: #2199 I just modified the concordance opts in the file:
Except I added another commit after the fact to correct my atrocious spelling of the word received. If this is satisfactory enough, I'd forego that bounty, but I'm not exactly sure how to do that. Just looking to make contributions. |
Both due to the age of this issue, and the state of our reporters, I've decided to roll this into #2501. |
* Explain diff gutter symbols. Fixes #1558 * Add test result labels. Color covers figure and label, and indicates passed-as-expected vs. not (expected/unexpected fail or unexpected pass). Fixes #2919 * Bold the source line of errors in code excerpts * TAP reporter: Strip ANSI control sequences from error labels * Print assertion error in italics, to better differentiate from the test title. Co-authored-by: Mark Wubben <mark@novemberborn.net>
Please see this comment: #1558 (comment)
Original issue follows.
Description
When using
t.snapshot(foo)
andfoo
does not match the snapshot, the diff that is shown uses-
to indicate the newfoo
values and+
to show the oldfoo
values.This is unintuitive.
I believe the problem may be at
ava/lib/assert.js
Line 321 in 14f7095
Test Source
Environment
Latest stable ava on OS X
IssueHunt Summary
Backers (Total: $60.00)
Submitted pull Requests
Become a backer now!
Or submit a pull request to get the deposits!
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor
The text was updated successfully, but these errors were encountered: