Debug Jest tests from VS Code

Georgi Parlakov
1 min readFeb 19, 2019

--

Want to debug just one single test using jest?

Let me offer you one trick to add into your launch.json debug configuration to enable debugging of the test you are currently editing in VS Code i.e. cursor is in that test.

Consider the following snippet:

The main thing here is to take the ${fileBasename} from VS Code and give it to jest to make it run only that

After you add that to your VS Code launch.json you can just F5 when “in” that test and voila — debugging only that file. And if you fit that test — only that single test.

Or you might want to debug all of them at once (this might be slow):

Thanks for reading :)

--

--

Georgi Parlakov
Georgi Parlakov

Written by Georgi Parlakov

Angular and DotNet dev. RxJs explorer. Testing proponent. A dad. Educative.io course author. https://gparlakov.github.io/

No responses yet