lorenzofox3 / zora

Lightest, yet Fastest Javascript test runner for nodejs and browsers
MIT License
539 stars 93 forks source link

Fix Maps/Sets/TypedArrays reporting #178

Closed jwhitaker-swiftnav closed 11 months ago

jwhitaker-swiftnav commented 1 year ago

These will likely fail until #176 is merged, however after that this should fix reporting of Maps/Sets/TypedArrays. I have made them report as {"Map": {"k":"v",...}} which is maybe not ideal. Additionally there's now a JSON encode/decode roundtrip in the diff report in order to be able to reuse the code in createReplacer without writing/pulling in a recursive object visitor algo, again this is maybe not ideal.

The only other low-effort way I could think of for this though would be to serialize directly as e.g. {"k":"v"}, and sets/arrays as ["a","b",...], i.e. make them indistinguishable from plain objects and arrays. That would likely still have the JSON round tripping in it as well.