qunitjs / js-reporters

📋 Common Reporter Interface (CRI) for JavaScript testing frameworks.
MIT License
60 stars 18 forks source link

Reporter: handle objects with cycles #130

Closed zackthehuman closed 3 years ago

zackthehuman commented 3 years ago

Updating TapReporter with the ability to handle objects with circular references. This is needed for proper stringification of actual and expected values that contain cycles.

Fixes #104

zackthehuman commented 3 years ago

I need to crunch on this a little bit more. The existing approach can have false positives as long as the same object appears more than once (even when it's not cyclical). I also have to fix the linting errors.

zackthehuman commented 3 years ago

Circling back on this: I think there are many improvements we can make to the serialization outside of handling ref cycles. It would be worth having an issue dedicated to those improvements so that we can figure out what "ideal" serialization looks like.

In the short term, it would help me (and others) to land this fix. I've squashed/rebased my changes, so it should be in a reviewable state. @Krinkle if you have any time would you mind taking a look?