If you are using visual studio code, you can use the following configuration. Hope this helps someone a few hours.
My setup:
- Project with failed project create-react-app (1.3.1)
- Node version: v6.10.3
- Npm Version: 4.6.1
To get this working, I also needed to install jest-file and jest-css using npm i --save-dev jest-file jest-css . They are used as file transformers, so the joke does not complain about importing files, such as svg.
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Test with debugger", "type": "node", "request": "launch", "port": 5858, "runtimeArgs": [ "--debug-brk", "--nolazy" ], "program": "${workspaceRoot}/node_modules/jest/bin/jest.js", "args": [ "--runInBand", "--transform={\"^.+\\\\.(js|jsx)$\": \"babel-jest\",\"^.+\\\\.css$\": \"jest-css\",\"^(?!.*\\\\.(js|jsx|css|json)$)\": \"jest-file\"}" ], "cwd": "${workspaceRoot}" } ] }
Explanation
- nolazy: fully compile code so that we can use breakpoints correctly
- runInBand: stop Jest from spawning tests in workflows
- transform: stop errors when importing files such as svg. If you add this to package.json, the response scripts will not let you run npm test because it does not support overwriting conversion parameters.
The following lines should be added to package.json or .babelrc
"babel": { "sourceMaps": "inline", "presets": [ "react-app" ] }
Explanation
sourceMaps: it must be either "inline" or "both." If you do not install this, when debugging the tests, you will see the rewritten code instead of the source.
presets: react-app is the default preset for the create-react-app project. If you do not include this in package.json or .babelrc, you will get errors because jest will not know how to handle jsx.
Result 
If you are not using visual studio code , you can run the following command and connect to the debugging session using another GUI debugger: node --debug-brk ./node_modules/jest/bin/jest.js --runInBand --config=./jest-config.json . Just remember to set the below configuration in the jest-config.json :
"transform": { "^.+\\.(js|jsx)$": "babel-jest", "^.+\\.css$": "jest-css", "^(?!.*\\.(js|jsx|css|json)$)": "jest-file" }