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

Reset depth when formatting differences #62

Merged
merged 3 commits into from May 11, 2020
Merged

Reset depth when formatting differences #62

merged 3 commits into from May 11, 2020

Conversation

bunysae
Copy link
Contributor

@bunysae bunysae commented May 9, 2020

As i mention in issue #41 just render the diff with unlimited depth would fix this issue. This can be done with the new option renderDiffWithUnlimitedDepth.
Successor for PR #61.


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@novemberborn
Copy link
Member

Thinking about it, I don't think we should render with unlimited depth. But we could take the max depth and start counting at 0 again for the diffs?

We should make that the default behavior, no option required. What do you think?

@papb
Copy link
Contributor

papb commented May 10, 2020

I would be happy with either approach I guess, the depth is just too shallow currently...

@bunysae
Copy link
Contributor Author

bunysae commented May 11, 2020

I implemented the current indent as offset, when a diff is reached.
Now it gives the result:

  [
    Object { … },
+   {
+     d: 'bar',
+     e: 'g',
+     f: Object { … },
+   },
  ]

for

const o1 = [
        {
                b: 'b'
        },
        {
                d: 'bar',
                e: 'g',
                f: {
                        h: 'h'
                }
        }
];
const o2 = [
        {
                b: 'b'
        }
];

console.log(concordance.diff(o2, o1, {maxDepth: 1}));

@novemberborn novemberborn changed the title Render diff with unlimited depth Reset depth when formatting differences May 11, 2020
@novemberborn novemberborn merged commit 7ee06d8 into concordancejs:master May 11, 2020
@novemberborn
Copy link
Member

@bunysae lovely, thanks!

Could you submit your PR at https://issuehunt.io/r/concordancejs/concordance/issues/41?

@novemberborn
Copy link
Member

I will try to roll this into the next AVA release, probably this weekend.

@bunysae
Copy link
Contributor Author

bunysae commented May 13, 2020 via email

novemberborn added a commit to avajs/ava that referenced this pull request May 24, 2020
* Update dev dependencies

* Test with TypeScript 3.9

* Update dependencies

This includes a major update to Concordance, letting us print missing or extraneous objects in diffs with extra depth. See concordancejs/concordance#62.

* Rebuild package-lock
This was referenced Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format extra level of extraneous / missing complex items when depth limit is reached
3 participants