_From @trivikr on August 30, 2018 6:48_
Debug Jest with current test file doesn't stop at correct breakpoint in VSCode
Debugger stops at Line 28
_Copied from original issue: facebook/jest#6918_
_From @SimenB on August 30, 2018 10:22_
This works in Chrome and IntelliJ, so it's an issue with vs code, not Jest (maybe https://github.com/jest-community/vscode-jest?).


Having the exact same issue. Works with Chrome, but not VScode
jest uses flow, and vscode uses sourcemaps to debug these transpiled codes. There are a few suggestions on how to debug flow in vscode, such as here.
But for your use case, I found a simple line in .babelrc worked just fine without the full sourcemaps support:
"retainLines": true
I fixed it by setting "sourceMaps": false, in launch.json
Thank you @connectdotz, I've posted fix in Jest repo at https://github.com/facebook/jest/pull/6985
Thank you @Morikko for sharing another option. I tried it, but it didn't work in some situations (like with file notify-reporter.test.js)
The fix was merged in https://github.com/facebook/jest/commit/68eb9a232dcbd4ecf85bb1f0bdad5cb850dff81a
Yes, I also had trouble with the previous solution. Breakpoints were in the right place but actually executing code at another place.
I added "runtimeArgs": ["-r", "flow-remove-types/register"], to my project configuration (launch.json) but it still doesn't work. My project is not using flow but standard javascript.
I am calling jest from ./node_modules/jest/bin/jest.js.
Did you do other things ?
This issue was raised in Jest's code base, and it was fixed with adding "runtimeArgs": ["-r", "flow-remove-types/register"] in launch.json in commit https://github.com/facebook/jest/commit/68eb9a232dcbd4ecf85bb1f0bdad5cb850dff81a
Most helpful comment
I fixed it by setting
"sourceMaps": false,inlaunch.json