Skip to content

Instantly share code, notes, and snippets.

@riddla
Last active May 23, 2021 07:20
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riddla/8830e0485dd0a48533c8fb05da2df09d to your computer and use it in GitHub Desktop.
Save riddla/8830e0485dd0a48533c8fb05da2df09d to your computer and use it in GitHub Desktop.
Debug ES6 React using Jest with Visual Studio Code (VSCode)
{
"presets": [
"react",
"es2015"
],
"sourceMaps": "inline",
"retainLines": true
}
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Launch Jest",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"cwd": "${workspaceRoot}",
"args": ["--runInBand"],
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true
}]
}
{
"devDependencies": {
"babel-jest": "^18.0.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babel-register": "^6.22.0",
}
}
@Vikaskumargd
Copy link

Hi @riddla,
I have issue with setting up debugger for jest in vscode for CRA . I tried every possible solution including one which is given here( https://facebook.github.io/jest/docs/en/troubleshooting.html ).

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug CRA Tests",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
      "runtimeArgs": [
        "--inspect-brk",
        "test"
      ],
      "args": [
        "--runInBand",
        "--no-cache",
        "--env=jsdom"
      ],
      "cwd": "${workspaceRoot}",
      "protocol": "inspector",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]
}

please can you help me with this .

@gibbok
Copy link

gibbok commented Sep 13, 2017

@Vikaskumargd thanks it works great on the latest VS.

@codialsoftware
Copy link

@Vikaskumargd this works only if you add port: 9229, at least for me on insiders build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment