Prettier Jest Unit Test Messages for Angular And React
From this article you’ll learn how to make Jest unit test messages pretty for your Angular and React apps
You know me (at least if you’re subscribed to my articles). I like to optimize and improve stuff. That is the reason I’ve created Hinty. Because it’s so far the fastest way to annotate code with coding and project scope knowledge.
You just provide a regex and message. Like on this GIF:
A more practical example:
"regex": "1rem",
"message": "16px",
"fileRegex": "^.*\\.(css|scss)$"
That hint shows up in CSS and SCSS files. Whenever you write “1rem” it will display how much it is in pixels. I love how easy to use the extension is and use it on a daily basis.
What brings up an interesting question. If it is so great, can it be used in other places too?
And I’ve stumbled upon a place where something like Hinty would also be beneficial. I’m sure it would be language agnostic too. I’ll show you it on the example of an Angular app. But the ready to use code is good for every project that uses Jest unit testing. So for example for a lot of React apps too.