Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98994

Problem to get vscode to debug jest tests in a typescript environment

$
0
0

I need help with getting vscode debug jest tests in a typescript environment. I compile my project by using a tsconfig file called tsconfig.debug.json and i compile my code like so:

./node_modules/.bin/tsc -p tsconfig.debug.json

The contents of this config file is:

{
  "compilerOptions": {
    "target": "es6",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "react",
    "outDir": "out",
    "sourceMap": true
  },
  "include": [
    "src"
  ]
}

I have a launch.json that looks like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "name": "vscode-jest-tests",
      "request": "launch",
      "args": ["--runInBand"],
      "cwd": "${workspaceFolder}",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest",
      "outFiles": ["out/**/*.js"]
    }
  ]
}

I can launch jest. I can set break points at which the debugger stops. But I cannot step my program. If I try I seem step in random pieces of jest code.

What am I doing wrong?

I have used a recent typescript adaption of create-react-app to create my project.


Viewing all articles
Browse latest Browse all 98994

Latest Images

Trending Articles



Latest Images