title: Cannot run Jest tests for components (Failed to load html files)
body: <p>I am not able to run Jest tests on my components since it is not able to load html files.
  I get this error:</p>
  <pre><code>Error: Error: connect ECONNREFUSED 127.0.0.1:80
  </code></pre>
  <p>Followed by:</p>
  <pre><code>Unhandled Promise rejection: Failed to load landing.component.html
  </code></pre>
  <p>Running non-component tests is fine.</p>
  <p>Here is my <code>jest.config.js</code></p>
  <pre><code>/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
  module.exports = {
    preset: &quot;jest-preset-angular&quot;,
    testEnvironment: &quot;jsdom&quot;,
    setupFilesAfterEnv: [&quot;&lt;rootDir&gt;/setup-jest.ts&quot;],
    globals: {
      &quot;ts-jest&quot;: {
        tsconfig: &quot;&lt;rootDir&gt;/tsconfig.spec.json&quot;,
        stringifyContentPathRegex: &quot;\\.(html|svg)$&quot;,
      },
    },
    snapshotSerializers: [
      &quot;jest-preset-angular/build/serializers/html-comment&quot;,
      &quot;jest-preset-angular/build/serializers/ng-snapshot&quot;,
      &quot;jest-preset-angular/build/serializers/no-ng-attributes&quot;,
    ],
    moduleDirectories: [&quot;node_modules&quot;, &quot;.&quot;],
    testMatch: [&quot;**/+(*.)+(spec|test).+(ts|js)?(x)&quot;],
    transform: {
      &quot;^.+\\.(ts|js|html)$&quot;: &quot;ts-jest&quot;,
    },
    resolver: &quot;@nrwl/jest/plugins/resolver&quot;,
    moduleFileExtensions: [&quot;ts&quot;, &quot;js&quot;, &quot;html&quot;],
    coverageReporters: [&quot;html&quot;],
  };
  </code></pre>
  <p>My <code>setup-jest.ts</code></p>
  <pre><code>import 'jest-preset-angular/setup-jest';
  </code></pre>
  <p>And my <code>tsconfig.spec.json</code></p>
  <pre><code>{
    &quot;extends&quot;: &quot;./tsconfig.json&quot;,
    &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;./out-tsc/spec&quot;,
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;types&quot;: [&quot;jest&quot;, &quot;node&quot;],
      &quot;allowJs&quot;: true,
      &quot;esModuleInterop&quot;: true,
      &quot;emitDecoratorMetadata&quot;: true
    },
    &quot;files&quot;: [&quot;setup-jest.ts&quot;],
    &quot;include&quot;: [&quot;src/**/*.spec.ts&quot;, &quot;src/**/*.d.ts&quot;]
  }
  </code></pre>
  <p>And the Jest portion from <code>angular.json</code></p>
  <pre><code>&quot;test&quot;: {
    &quot;builder&quot;: &quot;@nrwl/jest:jest&quot;,
    &quot;options&quot;: {
      &quot;jestConfig&quot;: &quot;jest.config.js&quot;,
      &quot;passWithNoTests&quot;: true
    }
  }
  </code></pre>
  <p>I am using Angular 12.2.7, Jest 27.2.4, jest-preset-angular 10.0.1 and ts-jest 27.0.5.</p>