title: Jasmine with Karma: Ajax not working
body: <h2>Issue</h2>
  <p>I am running Javascript tests using <a href="http://jasmine.github.io/" rel="nofollow noreferrer">Jasmine</a> and <a href="http://karma-runner.github.io/" rel="nofollow noreferrer">Karma</a>(As a test runner). The issue is that <code>Ajax</code> requests do not seam to be working.</p>
  <p>If I run the following Jasmine test with Karma:</p>
  <pre><code>describe(&quot;Tests Ajax&quot;, function(done){
      it(&quot;does not work&quot;, function(){
          var options = {
              &quot;url&quot;: &quot;http://www.google.com&quot;,
              &quot;method&quot;: &quot;GET&quot;,
              &quot;complete&quot;: function(data){
                  console.log(&quot;Done!&quot;);
                  done();
              }
          };
  
          $.ajax(options);
      });
  });
  </code></pre>
  <p>I get the following Karma error:</p>
  <pre><code>        PhantomJS 1.9.8 (Windows 8) Tests Ajax does not work FAILED
              Error: Timeout - Async callback was not invoked within timeout specified
              by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  </code></pre>
  <p>This means that the test took to long. I have tried setting <code>jasmine.DEFAULT_TIMEOUT_INTERVAL</code> to a longer time in <code>beforeEach</code> but this does not seam to change the results.</p>
  <p>If I then run the above Ajax code in my browser it works and outputs &quot;Done!&quot; almost immediately.</p>
  <p>The above results lead me to conclude that for some reason Ajax requests do not work when running Jasmine tests with Karma.</p>
  <h2>Additional Information</h2>
  <p><strong>OS</strong>: Windows 8<br />
  <strong>Karma Test Browsers</strong>: PhantomJS(I have also tested with IE, Chrome, ChromeCanary, and Firefox, result are the same)<br />
  <strong>Karma Version</strong>: 0.12.31<br />
  <strong>Karma Jasmine Version</strong>: 0.3.2</p>
  <p><a href="http://pastebin.com/2yYMgMVn" rel="nofollow noreferrer">Karma Config File</a><br />
  <a href="https://github.com/Noah-Huppert/NoahHuppert.com/tree/ts-test-suite" rel="nofollow noreferrer">Github Repo</a></p>
  <p>I am choosing not to use <a href="https://github.com/jasmine/jasmine-ajax" rel="nofollow noreferrer">Jasmine Ajax</a> because the code I am testing involves putting together various Ajax <code>options</code> correctly based on many other conditions and then interpreting the results. Thus completing a real Ajax request(To local files) is necessary.</p>