title: Visual Studio Code won't properly step on TypeScript code
body: <p>I am trying to configure Visual Studio Code to use TypeScript (in a Node package), I'm also using <code>ts-jest</code>/<code>Jest</code> to create tests, additionally, I have the Jest extension installed.</p>
  
  <p>I have been able to figure out how to make breakpoints work, but now I notice I can't properly step in my code, I'm not even 100% sure the breakpoints work perfectly.</p>
  
  <p>When clicking the step button, the execution is resumed and it never stops again on the next line, the only way to make it stop is to place other breakpoints where I want. The code <em>does</em> stop at the right place where the breakpoints have been set AFAICT.</p>
  
  <p><strong>EDIT:</strong> Actually, stepping sometimes stops again, but on what seems to be js code from implementation (for instance, console.log steps to code related to logging, but never steps again on my code)</p>
  
  <p><strong>EDIT #2:</strong> By trying to reproduce the issue with a simpler project, I realise not importing any more a library I'm using (Phaser) fixes the issue, I hope this can help isolate the cause of the issue.</p>
  
  <p><strong>EDIT #3:</strong> Here is a link to something that reproduces the issue I'm speaking about: <a href="https://github.com/adtrevor/VSCodeDebugIssue" rel="noreferrer">https://github.com/adtrevor/VSCodeDebugIssue</a>
  If you want to test it, just clone it, <code>npm install</code> and launch the "Debug Jest Tests" task from the run/debug panel. Set a breakpoint on <code>line 23</code> of <code>hey.ts</code> (first instruction of <code>barFunction()</code>), the debugger will stop there, but if you step in the code, you should notice that at some point you leave current scope (after executing <code>console.log("B")</code> in my case) and never come back to it.</p>
  
  <p><strong>EDIT #4:</strong> Here is a more complete example showing the issue <a href="https://github.com/adtrevor/TSVSCodeSOQuestion/" rel="noreferrer">https://github.com/adtrevor/TSVSCodeSOQuestion/</a>. If you clone it, install dependencies, and set a breakpoint to line 156 of ChunkManager.ts, you will notice stepping doesn't behave properly even though I applied the changes of @GiacomoDeLiberali. Maybe the bug is related, though.</p>
  
  <p>I don't know at all what's wrong with the configuration or where to look first as I have no other error message regarding the debugging. Here is the content of my config files:</p>
  
  <p><strong>launch.json</strong></p>
  
  <pre><code>{
    // Use IntelliSense to learn about possible Node.js debug 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": "Debug Jest Tests",
        "cwd": "${workspaceFolder}",
        "args": [
          "--inspect-brk",
          "${workspaceRoot}/node_modules/.bin/jest",
          "--runInBand",
          "--config",
          "${workspaceRoot}/jest.config.js"
        ],
        "windows": {
          "args": [
            "--inspect-brk",
            "${workspaceRoot}/node_modules/jest/bin/jest.js",
            "--runInBand",
            "--config",
            "${workspaceRoot}/jest.config.json"          
          ],
        },
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen",
      },
    ]
  }
  </code></pre>
  
  <p><strong>settings.json</strong></p>
  
  <pre><code>{
      "editor.fontSize": 14,
      "workbench.colorTheme": "Default Light+",
      "window.autoDetectColorScheme": true,
      "debug.node.autoAttach": "off",
      "jest.pathToConfig": "./jest.config.js",
  }
  </code></pre>
  
  <p><strong>jest.config.json</strong></p>
  
  <pre><code>module.exports = {
    preset: 'ts-jest',
    testEnvironment: 'node',
    testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
    rootDir: './src/'
  };
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es6",
          "module": "CommonJS",
          "strict": true,
          "noImplicitAny": true,
          "allowJs": true,
          "jsx": "preserve",
          "importHelpers": true,
          "moduleResolution": "node",
          "experimentalDecorators": true,
          "esModuleInterop": true,
          "allowSyntheticDefaultImports": true,
          "sourceMap": true,
          "baseUrl": "./src",
          "noEmit": false,
          "outDir": "./build/",
  
          "paths": {
            "~/*": ["./*"]
          },
          "typeRoots": [
              "node_modules/@types",
              "node_module/phaser/types"
          ],
          "types": [
              "phaser",
              "jest"
          ]
      },
      "include": [
          "src/**/*"
      ]
  }
  </code></pre>
  
  <p>And finally my Package.json:</p>
  
  <pre><code>{
      "name": "mypackagename",
      "description": "Client for the game",
      "version": "0.1.0",
      "dependencies": {
          "phaser": "^3.22.0",
          "tslib": "^1.11.1"
      },
      "devDependencies": {
          "@types/jest": "^25.2.1",
          "bufferutil": "^4.0.1",
          "canvas": "^2.6.1",
          "jest": "^25.2.7",
          "ts-jest": "^25.3.1",
          "typescript": "^3.8.3",
          "utf-8-validate": "^5.0.2"
      }
  }
  </code></pre>
  
  <p>Do you see anything unusual with this config? In general, what could be the cause of such a behaviour?</p>