DEV Community

Cover image for Matt's Tidbits #97 - Running/Debugging individual Jest unit tests
Matthew Groves
Matthew Groves

Posted on • Originally published at Medium

Matt's Tidbits #97 - Running/Debugging individual Jest unit tests

Last week I wrote about React Fragments. This week, I have a quick tidbit about running tests in VS Code.

I hope you all had a restful long weekend! I've written about the importance of vacation before, and in this pandemic that just seems to keep on going (although hopefully we're starting to see the end), it's more important now than ever to prioritize your health and take care of yourself!

As you may have noticed, since I've been writing about it a bunch recently, my current project is using React Native. We're using Jest for our unit tests, and it's a pretty decent tool. However, it caught me slightly by surprise that the only way (that I knew of) to run our tests was via a yarn test command that ran them all at once. This became especially troublesome when I had to debug a failing unit test (perhaps I'll write about that next time), and was trying to find a way to shorten my write/test cycle.

Thankfully, one of my coworkers pointed me at a VERY helpful VS Code extension: https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner

This extension provides links next to each unit test to let you run or debug them individually! If you're using Jest & VS Code, you really MUST download this extension - I guarantee you it will come in handy!

What are your favorite VS Code extensions? Let me know in the comments below!

Interested in working with me in the awesome Digital Products team here at Accenture? We're hiring!

Top comments (0)