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

Show sets in output #44

Merged
merged 1 commit into from Mar 21, 2024
Merged

Show sets in output #44

merged 1 commit into from Mar 21, 2024

Conversation

EvanHahn
Copy link
Contributor

Before this change, Sets were not shown in the output.

For example, t.alike(new Set([1, 2]), new Set([3, 4])) would show:

not ok 1 - should deep equal
  ---
  actual:
  expected:
  ...

Now it shows this:

not ok 1 - should deep equal
  ---
  actual:
    - 1
    - 2
  expected:
    - 3
    - 4
  ...

Before this change, `Set`s were not shown in the output.

For example, `t.alike(new Set([1, 2]), new Set([3, 4]))` would show:

    not ok 1 - should deep equal
      ---
      actual:
      expected:
      ...

Now it shows this:

    not ok 1 - should deep equal
      ---
      actual:
        - 1
        - 2
      expected:
        - 3
        - 4
      ...
@@ -108,7 +108,7 @@ function toYAML (o, maxDepth = 5, indent = '', prev = null) {
return '|\n' + o.split('\n').map(s => indent + s).join('\n').trimRight() + '\n'
}

if (o && Array.isArray(o)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly related, but the o && check was unnecessary here.

EvanHahn added a commit to digidem/mapeo-core-next that referenced this pull request Feb 20, 2024
`waitForPeers()` has a `waitForDeviceInfo` option. When enabled, this
helper should resolve only after device info is populated.

It had a tricky bug that only manifested some of the time (see
[example CI failure 1][1], [2]). In some cases, the function could
_think_ device info was populated when it wasn't.[^CI]

To fix this, I reworked the helper. It now does redundant work but it's
now stateless-ish, which should avoid this problem.

[^CI]: Well, that's what I could reproduce locally. The errors on CI are
       unhelpful ([which I hope to fix in Brittle][brittle PR]). It's
       possible a different problem exists on CI that I couldn't repro
       locally.

[1]: https://github.com/digidem/mapeo-core-next/actions/runs/7925562783/job/21731451900
[2]: https://github.com/digidem/mapeo-core-next/actions/runs/7965492933/job/21745121763
[brittle PR]: holepunchto/brittle#44
EvanHahn added a commit to digidem/mapeo-core-next that referenced this pull request Feb 20, 2024
`waitForPeers()` has a `waitForDeviceInfo` option. When enabled, this
helper should resolve only after device info is populated.

It had a tricky bug that only manifested some of the time (see
[example CI failure 1][1], [2]). In some cases, the function could
_think_ device info was populated when it wasn't.[^CI]

To fix this, I reworked the helper. It now does redundant work but it's
now stateless-ish, which should avoid this problem.

[^CI]: Well, that's what I could reproduce locally. The errors on CI are
       unhelpful ([which I hope to fix in Brittle][brittle PR]). It's
       possible a different problem exists on CI that I couldn't repro
       locally.

[1]: https://github.com/digidem/mapeo-core-next/actions/runs/7925562783/job/21731451900
[2]: https://github.com/digidem/mapeo-core-next/actions/runs/7965492933/job/21745121763
[brittle PR]: holepunchto/brittle#44
@mafintosh mafintosh merged commit 1ceb75c into holepunchto:main Mar 21, 2024
@mafintosh
Copy link
Contributor

Awesome! 3.4.1

@EvanHahn EvanHahn deleted the set-support branch March 21, 2024 13:10
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.

None yet

2 participants