Closed hugocaillard closed 7 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
stacksjs-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 20, 2024 6:31pm |
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
922e037
) 66.37% compared to head (920efdf
) 66.37%.:exclamation: Current head 920efdf differs from pull request most recent head 3d18e85. Consider uploading reports for the commit 3d18e85 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm fine with sorting. For use in tests it's great. Maybe let's add a note to not use the function for keeping keys in a specific order. (I think in some cases key order can have consequences, but less likely users will use this for it)
Comment addressed @janniks @zone117x Thx for the feedback!
If this can be included in the next release of stacks.js, I'd like to include it in the next release of clarinet
Description
Change
Cl.prettyPrint
so that it sorts properties in a tuple. This an opinionated change and I could do it in Clarinet, but it kind of make sense to have it natively here as well. I would understand if one disagrees though.Breaking change?
Not really, in the sense that developers shouldn't rely on the property output of this method, this is mostly for debugging
Example
Cl.prettyPrint
is used in the clarinet sdk to show output diffs in tests. Because the output is just a string, Vitest can fail to properly render the diff of the properties of the expected tuple vs the actual tuple are not in the same orderSee below where only the value of
a
changes.With this PR, it would display
Clarinet already does this sorting in
expectTuple
, but this is actually needed for every composite types (some, ok, err, list, tuple) and with nested values. It could be done at the clarinet level but Cl.prettyPrint already handle the recursive nature of clarity values.Checklist