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

Assert.Equal show only diff #1628

Open
wmcnamee-coreweave opened this issue Jul 23, 2024 · 2 comments
Open

Assert.Equal show only diff #1628

wmcnamee-coreweave opened this issue Jul 23, 2024 · 2 comments

Comments

@wmcnamee-coreweave
Copy link

Description

Wondering if there's a way to show only the diff and not this part:

Error:      	Not equal:
        	            	expected: ...
        	            	actual ...

I have large yaml strings I'm comparing, and this part of the test output is completely useless. The diff looks fine though.

Proposed solution

Use case

@tscales
Copy link
Contributor

tscales commented Aug 27, 2024

That's currently not possible with any of the assertion functions. That formatted string always gets returned.

https://github.com/stretchr/testify/blob/v1.9.0/assert/assertions.go#L466-L469

I agree that tends to not be helpful for large strings and interfaces.

As a side note for your use case: The assertions package also hasYAMLEq

@brackendawson
Copy link
Collaborator

I also dislike scrolling past a large object twice to get to the diff. But I sometimes copy and paste the objects into a better diff viewer. I'd support a change that moved the diff to the top.

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

3 participants