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

base reporter: Use cson for stringification when diffing objects #1181

Closed
wants to merge 1 commit into from

Conversation

papandreou
Copy link
Contributor

This produces more compact output and prevents lines that only differ due to a dangling comma in the JSON.stringify output from showing up.

Before you would get a diff like this when the ASCIIbetically last property is missing from e.actual:

    + expected - actual

     {
       "a": 123,
    +  "b": 456
    -  "b": 456,
    -  "c": 789
     }

With this patch you'll get:

    + expected - actual

     {
       a: 123
       b: 456
    -  c: 789
     }

This produces more compact output and prevents lines that only differ due to a dangling comma in the JSON.stringify output from showing up.

Before you would get a diff like this when the ASCIIbetically last property is missing from e.actual:

    + expected - actual

     {
       "a": 123,
    +  "b": 456
    -  "b": 456,
    -  "c": 789
     }

With this patch you'll get:

    + expected - actual

     {
       a: 123
       b: 456
    -  c: 789
     }
@papandreou
Copy link
Contributor Author

Here's a less controversial version that doesn't introduce a new dependency, but doesn't remove the quotes around simple property names: #1182

@travisjeffery
Copy link
Contributor

ya no need to add a dependency for this

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.

2 participants