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

jest-diff: Do not inverse format if line consists of one change #8903

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

pedrottimark
Copy link
Contributor

@pedrottimark pedrottimark commented Sep 2, 2019

Summary

It distracts attention of reviewer if entire change line has inverse format

Test plan

Updated snapshots:

package test
11 jest-diff getAlignedDiffs
1 expect matchers

Realistic regression tests for the win: the code change was more subtle than I thought

Example pictures baseline at left and improved at right

The inverse lines fight for attention with the substrings within lines:

inverse 2

The inverse lines add insult to injury when cleanup merges from and to into changes because common o is chaff:

inverse 1

To set the record straight, merging o chaff into from and to changes is good cleanup. The problem is the length criterion where common substring 'change '.length does not have greater length than adjacent change substring 'delete\n'.length so is merged into changes.

Notice the effect of one character increase in length to 'changed '

inverse 3

@codecov-io
Copy link

codecov-io commented Sep 2, 2019

Codecov Report

Merging #8903 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8903      +/-   ##
==========================================
+ Coverage   64.24%   64.24%   +<.01%     
==========================================
  Files         275      275              
  Lines       11656    11658       +2     
  Branches     2844     2846       +2     
==========================================
+ Hits         7488     7490       +2     
  Misses       3544     3544              
  Partials      624      624
Impacted Files Coverage Δ
packages/jest-diff/src/getAlignedDiffs.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c588c18...f4e3794. Read the comment docs.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, great call!

@SimenB SimenB merged commit 8e0786f into jestjs:master Sep 4, 2019
@pedrottimark pedrottimark deleted the no-inverse-only-change branch September 4, 2019 13:33
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants