title: How to debug Unit Tests with Karma/Jasmine in Visual Studio Code?
body: <p>I'd like to be able to debug unit tests in Visual Studio Code, but so far it has been a mixed bag.</p>
  
  <p>My setup:</p>
  
  <p><strong>launch.json</strong></p>
  
  <pre><code>{
     "version": "0.2.0",
     "configurations": [
             {
                "name": "Debug tests",
                "type": "chrome",
                "request": "attach",
                "port": 9222,
                "sourceMaps": true,
                "webRoot": "${workspaceRoot}"
             }
     ]
  }
  </code></pre>
  
  <p><strong>karma.config.js</strong></p>
  
  <pre><code>customLaunchers: {
     Chrome_with_debugging: {
       base: 'Chrome',
       flags: ['--remote-debugging-port=9222']
     }
  }
  </code></pre>
  
  <p>This does seem to work in a way, if I launch the VS Code debugger it appears to attach (bottom bar turns orange). If I make a change, Karma kicks in and the debugger, too - but it invariably pauses in <code>zone.js</code> (this is an Angular project by the way) without me interfering in any way:</p>
  
  <p><a href="https://i.stack.imgur.com/FziXj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FziXj.png" alt="Paused in zone.js"></a></p>
  
  <p>If I hit 'Continue' it actually hits my breakpoint</p>
  
  <p><a href="https://i.stack.imgur.com/lEJvb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lEJvb.png" alt="enter image description here"></a></p>
  
  <p>and I can inspect some variables but not all of them,</p>
  
  <p><a href="https://i.stack.imgur.com/Uic05.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uic05.png" alt="Some vars are displayed, some not"></a></p>
  
  <p>For example, I can't see the value of <code>actual</code> passed into Jasmine's <code>expect</code> method.</p>
  
  <p>So a) Why does the debugger always pause inside <code>zone.js</code> - the tested code is from a Redux reducer and is invoked outside of any Angular context, and b) What am I missing in regards to not being able to inspect local variables (which is a showstopper right now)?</p>