Open ostrolucky opened 7 years ago
Yes, you're right. When you are comparing complex structures the differences become harder to read.
It could very well be redesigned, here are some ideas:
Use the background colour of the terminal to highlight lines that are different. This makes the differences stand out immediately but it useless when the colours are disabled (like on a CI).
We could produce a patch like PHPUnit. This focuses on the differences but doesn't always give a context that can make the output confusing.
We could put them side by side with a diff algorithm, like:
actual expected
[ [
5, 5,
2 3, // This line would be purple
2 // This line would be green
] ]
I'm keen to hear your ideas?
Best would be a combination of all 3:
If I had to do it simple though, I would just show +/- to current output
But I think important is also limiting amount of data shown. Phpunit is in this too restrictive and shows too little, but yours shows too much and it would be a problem when comparison data is large
Thats true, perhaps a CLI argument --context-lines
which defaults to a sensible number like 5. This would allow people to configure how many lines above and below the changes they would see?
produces
vs phpunit's
which produces