
Welcome to my blog ππ½
I'm a Front-End Developer with a passion for learning!
I write about Programming π©π½βπ» and Productivity Tips β
Search for a command to run...

Welcome to my blog ππ½
I'm a Front-End Developer with a passion for learning!
I write about Programming π©π½βπ» and Productivity Tips β
No comments yet. Be the first to comment.
In this series, you will find fast, short, and sweet tips/hacks that you may or may not be aware of. I will try to provide these (fairly) regularly on Fridays.
A Note on the Series: Fast Fridays π is a series where you will find fast, short, and sweet tips/hacks that you may or may not be aware of. I will try to provide these (fairly) regularly on Fridays. Tailwind CSS is a utility-first CSS framework tha...
Although my experience is primarily with front-end development, my current job is affording me the opportunity to do more full-stack work. Naturally, this meant that I needed to explore the different database GUIs available on the market. Here is a l...

A Note on the Series: Fast Fridays π is a series where you will find fast, short, and sweet tips/hacks that you may or may not be aware of. I will try to provide these (fairly) regularly on Fridays. In this Fast Friday tip, I'll explain how to crea...

Over the past year, Iβve started incorporating a Git GUI into my workflow. I still reach for the terminal about 90% of the time, but Iβve found that a GUI can really shine when it comes to things like viewing diffs, checking stashes, or resolving mer...

Simplifying Branch Management with Git Worktree

With all the AI tools popping up these days, I figured I'd try out some speech-to-text software in an attempt to boost my productivity. I've been hearing a lot about βdeveloping at the speed of thoughtβ, so here's a list of the top speech-to-text sof...

A Note on the Series:
Fast Fridays π is a series where you will find fast, short and sweet tips/hacks that you may or may not be aware of. I will try to provide these (fairly) regularly on Fridays.
When writing unit tests with Jest, I often want to isolate a particular test case. I find this especially true when working within a test suite that has gotten pretty large due to the number of features associated with a particular component.
Instead of taking the manual approach and commenting out the tests cases I want to ignore for the moment, Jest provides two helper methods test.only() and test.skip() that makes isolating specific tests a lot simpler.
The test.only() method is beneficial if you want to target π― individual tests within a suite. By default, Jest will run all tests within a suite unless instructed otherwise. When a minimum of one test case uses this method, Jest will only run the test cases that reference the .only() method.
I find myself using test.only() quite a bit these days. A common workflow for me is to implement a feature and then pinpoint the individual tests that I want to hone in on. This allows me to reduce the amount of output in the terminal and focus on the main task at hand.
The test.skip() method is helpful if you want to omit β© certain tests from a suite. When the .skip() method is used, Jest will skip over the relevant test case when running the test suite. I don't find myself using this method as often as test.only(), but I still find it to be a beneficial method to have in my back pocket.
Output when test.only() or test.skip() is used on an individual test.
π¨ Warning: Make sure to remove the
.only()or.skip()methods before committing your code. These methods are only meant to be used for debugging purposes and should not be used in final tests.
I hope this quick tip can be useful to you the next time you have to write tests. For an exhaustive list of global objects and methods associated with the test object, take a look at the official documentation .
As always, thank you for reading, and happy coding!