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

Use util.inspect() for console reporter #915

Merged
merged 1 commit into from May 11, 2019

Conversation

@kanongil
Copy link
Member

kanongil commented May 1, 2019

I don't know how much sense this patch makes, but I created it to solve #914.

Basically, I have replaced the serialization of the reported object / diff. Instead of using JSON.stringify(), I use the node built-in util.inspect().

The existing JSON-based serialization is not ideal, and is not able to represent modern types in a reasonable manner. E.g. the current implementation doesn't support Map and Set (represented as {}), or BigInt (crashes).

Using util.inspect() have the great advantage, that it can serialize all native types into somewhat reasonable representations, and should be updated with any new types as they become available.

One issue with this, is that node@8 doesn't support the compact and sorted options, resulting in 2 test failures.

@kanongil

This comment has been minimized.

Copy link
Member Author

kanongil commented May 6, 2019

Btw. this seems to fix #572.

@geek

This comment has been minimized.

Copy link
Member

geek commented May 8, 2019

@kanongil seems reasonable to me. I guess the big break will be for node 8 output. Seems like a breaking change, is that correct?

@hueniverse hueniverse added this to the 18.1.3 milestone May 11, 2019
@hueniverse hueniverse self-assigned this May 11, 2019
@hueniverse hueniverse merged commit 75df9ce into hapijs:master May 11, 2019
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
hueniverse added a commit that referenced this pull request May 11, 2019
hueniverse added a commit that referenced this pull request May 12, 2019
@hueniverse

This comment has been minimized.

Copy link
Member

hueniverse commented May 12, 2019

Not really breaking because the changes are to the console output which is not an API, but marking as such because node 8 will suffer a tiny bit with objects no longer broken into lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.