I\'m trying to debug Jest unit tests using VS Code. I have the following config file settings
\"configurations\": [
{
\"name\": \"Debug Jest Te
About debugging Jest unit tests using VSCode, create a the following file (path: .vscode/launch.json)
If you have created your app using create-react-app
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug tests watch mode",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache", "--watchAll=true"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
If you have created your app from scratch:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest watch all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
There are more configurations available, if you need more info check out: