- Your jest config is named
jest.json
. - You use
babel
. - You build to
build
.
Add the following code as a debugging configuration.
{
"version": "0.2.0",
"configurations": [
{
"name": "Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"stopOnEntry": false,
"args": [
"--config",
"jest.json",
"--runInBand"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node",
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/build/**/*.js"
]
}
]
}
Make sure the following lines are in your .babelrc
.
...
"sourceMaps": "inline",
"retainLines": true,
...
Set a breakpoint and debug!