question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improvements for `- expected, + actual` legends

See original GitHub issue

Fails are reported like this right now:

  - expected
  + actual

  - ObjectContaining { a: 0 }
  + { a: 0, b: 0 }

For a lot of people, the - expected, + actual legend will not be helpful if it is printed every time. There are already color hints and the - and + signs. And people also get used to reading the reports rather quickly

Ideas for improvements:

Add an option to control the legend (as we may implement different ways to show it)

  1. legend === 'standard'
  2. legend === 'compact'
  - expected  - ObjectContaining { a: 0 }
  + actual    + { a: 0, b: 0 }

Check the length of the stringified values, print them as a single line with the legend if there are small enough

  1. legend === 'once' compact + in watch mode, only show the legend on the first error, then later avoid it.
  2. legend === 'none' Don’t show it
  3. legend === 'auto' NO_COLOR or CI is present ? ‘compact’ : ‘none’

We don’t need to have all the options, maybe just ‘compact’ and ‘auto’ are good to start with and users may not ask for anything else. And I think we should use ‘auto’ as the default

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
patak-devcommented, Dec 16, 2021

I like that @tony-go, it is what I had in mind for compact (if the length isn’t needed, better) One detail, I would prefer:

  expected   ObjectContaining { a: 0 }
  actual     { a: 0, b: 0 }
  1. remove the :, as it could be confused with object notation, just add a few extra spaces and I think is enough to separate the legend from the value (like a table)
  2. align the values, important when they are similar, and also helps with the table look
  3. Maybe expected and actual could be colored with a darken tone, so the user can focus on the values instead of the legends, and we again better separate the two

Maybe we could start with this, and we don’t need options then as you said. What do you think?

2reactions
tony-gocommented, Dec 16, 2021

I could give a try on this one ☝🏼 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

All Upcoming League of Legends Reworks | EarlyGame
Let's take a look at all the reworks Riot is currently working on. Is your favorite champion getting a rework soon?
Read more >
Arceus: 10 Things The Next Game Should Improve - CBR
Fans will expect an improved experience that capitalizes on what Legends: Arceus did well and improves or outright removes what it didn't.
Read more >
Pokémon Legends: Arceus - Top 8 Improvements To The ...
Pokémon Legends: Arceus introduced multiple new mechanics and took several risks, resulting in a decisive improvement compared to previous ...
Read more >
10 Changes To Make Pokemon Legends - Arceus - TheGamer
Despite its warm reception, it's clear that Arceus could be improved in a number of ways. Being the first version of a brand-new...
Read more >
Apex Legends™ News and Updates - An Official EA Site
APEX LEGENDS™ BEAST OF PREY COLLECTION EVENT ... From September 20th to October 4th, Play Gun Run - a brand new limited-time mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found