For anyone seeking an answer, you debug jest with node-inspector. However this is a very slow process (2-5 minutes to debug a single test), and wasn't very useful in actual usage.
I haven't found a better way to debug Jest, however I have seen a lot of people doing the extra work to make jasmine or mocha work with react components. So that may be a more viable option until node-inspector is actually usable.
in your project directory. It should start the node process paused an listening (usually at port 5858) for a debugger. Visual Studio Code is an example of a nice graphical debugger for node.js that can be used to connect to the listening node process.
The simplest solution I found is to use VS CodeJavaScript Debug Terminal.
And it works with Typescript and Nrvl.Nx work-spaces out of the box.
Open the command palette and start Debug: JavaScript Debug Terminal:
Run tests in that terminal in a Watch modenpm test --watch.
Set a break-point in your file.
Make any change in a file you want to debug and save.
watch will run Jest tests against modified files.
When you want to narrow down the number of files run by the --watch, press p in the terminal and enter a pattern, which is just a part of the file name you want to test and hit [Enter]
To limit it to a single test in a file - focus it with f, so change it(...) to fit(...)
Adding jest configuration would work only if there is only one project. However, if there are multiple projects within its own folder (i.e. rootfolder/project1, rootfolder/project2), running "jest --watchAll --runInBand --coverage" with breakpoint either in the test file or the file under test would be good option
Now you can use debugger; within your test files to trigger line-of-code breakpoints in Google Chrome! 🐛 🔫
The script has two parts. First, it opens Chrome — to: chrome://inspect — and then it will start a Node process (where we can use debugger) that runs a jest file (from node modules) on a specific test file. As a result, you must have Jest installed in your project dependencies!