title: How to include HTML files in karma frontend testing via jasmine
body: <p>I'm trying to create frontend headless browser testing via karma/jasmine, but it seems as if the HTML files were not loaded, only the JS files. Whenever I include a JS file (among the <code>files: [ ]</code>), it is correctly executed, e.g. console.log is written out to the terminal. However, when I include any HTML files, it doesn't do anything; a script called in it is not executed, and I cannot access its elements either.</p>
  
  <p>karma.conf.js:</p>
  
  <pre><code>module.exports = function(config) {
    config.set({
      basePath: '',
      frameworks: ['jasmine'],
      files: [
        '../js/jquery-2.1.3.min.js',
        'index.html',
        'test.js'
      ],
      exclude: [
      ],
      preprocessors: {
      },
      reporters: ['progress'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_INFO,
      autoWatch: false,
      browsers: ['PhantomJS'],
      singleRun: true,
      concurrency: Infinity
    })
  }
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
        &lt;script&gt;console.log("Script in HTML")&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
            &lt;p id = "my_id1"&gt;
                Text in my_id1.
            &lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>test.js:</p>
  
  <pre><code>describe("A suite", function() {
    console.log( $("#my_id1").text() ); // currently outputs empty string
    it("contains spec with an expectation", function() {
      expect(true).toBe(true);
    });
  });
  </code></pre>
  
  <p>So the question is: how could I include HTML files so that they are correctly loaded in the browser (so that I can manipulate them via the JS code)?</p>