Skip to content

Better string and object diffs #3

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

Open
twada opened this issue Apr 6, 2016 · 6 comments
Open

Better string and object diffs #3

twada opened this issue Apr 6, 2016 · 6 comments

Comments

@Whoaa512
Copy link

Whoaa512 commented May 9, 2016

Any idea where one would start on the path to fixing this?

@twada
Copy link
Owner Author

twada commented May 10, 2016

@Whoaa512 Thanks!

With this power-assert-runtime project, I'm going to provide a way to power-assert users to create original renderer by themselves.

Developer documentation does not exist yet (sorry), however you will be able to create your pretty-diff renderer like
power-assert-renderer-comparison and configure it through power-assert-context-formatter.
If you have created a nice one, please contribute us!

@jamestalmage
Copy link
Contributor

jamestalmage commented Jun 7, 2016

I think it would be great if we were able to build some understanding into the renderer for object diffs and the graph:

var x = {a: 'a', b: 'b', c: 'c', ....lotsMoreProperties};
var y = {a: 'a', b: 'b', c: 'notC', ....lotsMoreProperties};

t.deepEqual(x, y);

Should produce:

t.deepEqual(x, y);
            |  |
            |  {c: 'notC', ...}
            {c: 'c', ...}

In other words, if it's possible, show where objects differ right in the graph, the ... portion can represent how they are the same.

Perhaps we can use color codes. Green ... means no diff was omitted. Red ... means there was a diff to large to be shown in the graph (at which point we add the more conventional multi-line diff below).

@twada
Copy link
Owner Author

twada commented Jun 10, 2016

@jamestalmage Ah, that's nice to have!

@Munter
Copy link

Munter commented Aug 15, 2016

The best object diff I've seen to date is the one produced by unexpectedjs. In not sure if that code is really reusable, but I recommend taking a look

@twada
Copy link
Owner Author

twada commented Aug 15, 2016

@Munter Thanks!

twada added a commit that referenced this issue May 16, 2018
remove `_capt` and `_expr` from empower-core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants