title: Jest tests run in bash, but generate ReferenceError: XMLHttpRequest is not defined in Visual Studio Code
body: <p>I am trying a very simple test in VSCode which I am trying to ensure my environment is set up to debug tests.  However, I do get errors which have nothing to do with my test.</p>
  
  <p>I am simply trying to run Jest with Angular 6 in VSCode and debug both my application and the tests.</p>
  
  <p>environment.ts</p>
  
  <pre><code>export const environment = {
      production: false
  };
  </code></pre>
  
  <p>environment.spec.ts</p>
  
  <pre><code>import { environment } from './environment';
  describe('Production environment', () =&gt; {
      it('should have the environment not set for production', () =&gt; {
          expect(environment.production).toBeFalsy();
      });
  });
  </code></pre>
  
  <p>environment.prod.ts</p>
  
  <pre><code>export const environment = {
      production: true
  };
  </code></pre>
  
  <p>environment.prod.spec.ts</p>
  
  <pre><code>import { environment } from './environment.prod';
  describe('Production environment', () =&gt; {
      it('should have the environment set for production', () =&gt; {
          expect(environment.production).toBeTruthy();
      });
  });
  </code></pre>
  
  <p>Error I receive:</p>
  
  <pre><code>FAIL  src/environments/environment.prod.spec.ts  ● Test suite failed to run
  
      ReferenceError: XMLHttpRequest is not defined
        at patchXHR (node_modules/zone.js/dist/zone.js:2926:39)
        at node_modules/zone.js/dist/zone.js:2919:5
        at Function.Object.&lt;anonymous&gt;.Zone.__load_patch (node_modules/zone.js/dist/zone.js:84:33)
        at node_modules/zone.js/dist/zone.js:2917:6
        at Object.&lt;anonymous&gt;.FUNCTION (node_modules/zone.js/dist/zone.js:9:65)
        at Object.&lt;anonymous&gt; (node_modules/zone.js/dist/zone.js:12:2)
        at Object.&lt;anonymous&gt; (node_modules/jest-preset-angular/setupJest.js:5:1)
  </code></pre>
  
  <p>setup-Jest.ts</p>
  
  <pre><code>/**
   * Jest setup file for automated testing
   */
  import 'jest-preset-angular';
  import './jestGlobalMocks';
  </code></pre>
  
  <p>.vscode/launch.json</p>
  
  <pre><code>{
      "version": "0.2.0",
      "configurations": [
          {
              "type": "node",
              "request": "launch",
              "name": "Jest All",
              "program": "${workspaceFolder}/node_modules/jest/bin/jest",
              "args": [
                  "--runInBand"
              ],
              "console": "integratedTerminal",
              "internalConsoleOptions": "neverOpen"
          },
          {
              "type": "node",
              "request": "launch",
              "name": "Jest Current File",
              "program": "${workspaceFolder}/node_modules/jest/bin/jest",
              "args": [
              "${relativeFile}"
              ],
              "console": "integratedTerminal",
              "internalConsoleOptions": "neverOpen"
          }
      ]
  }
  </code></pre>
  
  <p>This appears to happen simply from importing the basic code needed to get Jest to run.  However, this does run in the bash environment without an error.</p>