majestic
majestic copied to clipboard
Feature request: Syntax highlighter for snapshots?
Feature request: Syntax highlighter for snapshots?
Hi
Do you think it's possible to make snapshots display highlighted? It could be much more readble during comparison
The syntax is highlighted by default by passing --colors flag to Jest and then converting the output through https://www.npmjs.com/package/ansi-to-html but I have seen some instances where they are not highlighted.
Could you please let me know which version of Jest you are using and also would you be able to share a screenshot?
If you share a sample repo with highlight not working, it would be really useful as well.
Hmmm not sure if we are on the same page, let me clarify
I am using create-react-app with typescript. It currently is 23.6.0
but it doesn't matter.
When I run default test run, it is colored, but not syntax highligted, and AFAIK this is what --colors
stands for (red / green diffs).
Screen:
In case of Majestic, it's not hightlighted
But export FORCE_COLOR=true
or passing color arg does the same, so thats perfectly fine.
What I'm thinking is some smart solution to detect HTML and highlight it.
ansi-to-html
might be good to try writing some jest plugin, but I don't test only only html - snapshots are also great to test some mappings which output json-like format
Anyway - not a bug!
At least we could highlight based on the +
and -
.
Yes, since colors
is default in Jest, I think it should be default in Majestic config too. Actually IMO all default configs from jest should be passed
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is it just me or this has been fixed at least in master
?
Seems like the colors are all ok on my side.
I guess sometimes Jest doesn't send colors properly, unfortunately.