-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Show word diffs in strings when they are properties on an object #9940
Comments
@pedrottimark has already implemented word diff with background color highlighting for many matchers. Apparently you've found a missing one, snapshots? |
Just tried it out, it works for snapshots that are strings, but not for string properties in other structures being snapshotted. |
Is this just by word diffing each whole line? While not a super sophisticated solution (that'd have to come from something like #7893), I think that'd be good enough. Would also word diff property keys, but that could actually be a good thing for people that have typos in there. Some cases may be weird if it diffs |
Yes, for now I am using |
Thank you for giving this realistic example of the need for substring differences. For snapshots of serialized objects or elements, my tests of substring differences have been sadly divided almost equally between clear and confusing results. Therefore, I have been working on non-snapshot deep equality assertions:
Here is an overdue progress update on the relevant comparison project. Over Thanksgiving weekend, it hit me that prettier provides a pattern for data-driven differences. I have adapted its intermediate description tree and printing loop for steps 2 and 3:
Substring differences: baseline at left and improved at right: A goal of the description is valid ECMAScript, if you omit the
The next major step is to decide on an interface for the description plugins which provides enough information to keep improving the Your thoughts, questions, or concerns are welcome. |
Just kinda stunned, honestly. Those are incredible diffs. |
woah, those diffs look amazing @pedrottimark! You got me all fired up now 😀 |
@pedrottimark Hi, thanks for the last update. Are there any new updates on this topic? |
@pedrottimark those changes look great, are you still working on it or can share your branch so I/someone else can contribute? |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
I have some snapshots which are pretty chunky strings of markdown
I'd like to be able to more quickly see where the string differ!
This is already supported when directly diffing strings (
expect('a b').toEqual('a c')
orexpect('a c').toMatchSnapshot()
), but not for strings within other structures.Motivation
I'd like a clue where the difference starts
Example
Any snapshot
Pitch
It's a nice to have! :D
The text was updated successfully, but these errors were encountered: