How to configure vsCode to debug Jest unit tests?
- vsCode Debugging See documentation link to configure vcCode to debug Jest unit tests
- Regular breakpoint set using F9, do not work correctly
- Breakpoints set using the key word debugger; are working correctly
- File .vscode\launch.json example
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Jest All", "program": "${workspaceFolder}/node_modules/.bin/jest", "args": ["--runInBand"], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "windows": { "program": "${workspaceFolder}/node_modules/jest/bin/jest", } }, { "type": "node", "request": "launch", "name": "Jest Current File", "program": "${workspaceFolder}/node_modules/.bin/jest", "args": ["${relativeFile}"], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "windows": { "program": "${workspaceFolder}/node_modules/jest/bin/jest", } } ] }
If the debugger does not attach, replace the variable '${relativeFile}', with a string containing the filename you want to debug
No comments:
Post a Comment