DEV Community

Nithin Peter
Nithin Peter

Posted on

 

Jest Run It - Run and debug individual Jest tests from VS Code

While writing tests in Jest have you ever wanted to run a single test that you changed, but have to fiddle with Jest CLI arguments so that Jest can run only that test. I know, I have been there and it is painful.

Wouldn't it be nice if you could choose what test(s) to run right from your editor/IDE. And apparently IntelliJ family of IDEs had this feature for ages. I get so jealous when I pair with my co-worker who uses IntelliJ and they run/debug a test with the click of a button. My favorite IDE of the world, VS Code, couldn't do it. So I decided to find a solution and it resulted in me writing this VS Code plugin.

Introducing: Jest Run It πŸƒβ€β™€οΈπŸƒβ€β™‚οΈ

Jest Run It

How to get it?

Search for "Jest run it" in your VS Code extensions panel (Learn how?). You should be able to find it and click on install.

You can find more details about the configuration options details here: https://marketplace.visualstudio.com/items?itemName=vespa-dev-works.jestRunIt

Github link: https://github.com/nithinpeter/jest-run-it

Other notable features

Apart from able to run/debug individual tests it has few other tricks under the sleeve as well:

  1. Test explorer view Alt Text
  2. Editor title actions to run/debug tests Alt Text

Top comments (0)

11 Tips That Make You a Better Typescript Programmer

typescript

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!