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

Confusing unified diff when working with custom comparison rules #46

Open
skuzzle opened this issue Dec 2, 2022 · 0 comments
Open

Confusing unified diff when working with custom comparison rules #46

skuzzle opened this issue Dec 2, 2022 · 0 comments
Labels
component: core enhancement New feature or request

Comments

@skuzzle
Copy link
Owner

skuzzle commented Dec 2, 2022

When a snapshot assertion that uses custom comparison rules fails, it will still output a unified diff of all the text changes. This diff doesn't know about the custom rules, so all the differences will be printed, including those, that did not lead to the test failure (or even no differences at all if the custom rule involved a regex).

This problem is probably impossible to solve, as custom rules depend on the structured format being used while the unified diff is only calculated on text basis. There is no way for the diff engine to know which changes where excluded from the structural comparison.

As a first step, failure message could show a warning hint in case that custom rules were used during comparison.

To solve this, we need to propagate the information about rule mismatches up to the core where we currently assemble the assertion failure. This is not that easy because currently custom rules only affect the outcome (true/false) of snapshot comparison.

@skuzzle skuzzle added enhancement New feature or request component: core labels Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant