title: Loading external file from Karma/Jasmine test
body: <p>I'm trying to accomplish a Jasmine test (using Karma and IntelliJ 13) to validate JSON files. Ideally, my test would simply load a JSON file into a data object, then let me parse through to check for valid formatting and data. I don't need to validate functions before or after, nor do I need to test against a server.</p>
  
  <p>My basic setup is like this:</p>
  
  <pre><code>it("should load an external file", function(){
  var asyncCallComplete, result,
              _this = this;
          // asyncCallComplete is set to true when the ajax call is complete
          asyncCallComplete = false;
  
          // result stores the result of the successful ajax call
          result = null;
  
          // SECTION 1 - call asynchronous function
          runs(function() {
              return $.ajax('/test/config.json', {
                  type: 'GET',
                  success: function(data) {
                      asyncCallComplete = true;
                      result = data;
                  },
                  error: function() {
                      asyncCallComplete = true;
                  }
              });
          });
  
          // SECTION 2 - wait for the asynchronous call to complete
          waitsFor(function() {
              return asyncCallComplete !== false;
          }, "async to complete");
  
          // SECTION 3 - perform tests
          return runs(function() {
              return expect(result).not.toBeNull();
          });
  }
  </code></pre>
  
  <p>The problem is that no matter what path I use, I get a 404 error and the file won't load. I've tried loading an external JSON result from a remote server using this test service:</p>
  
  <p><a href="http://date.jsontest.com/">http://date.jsontest.com/</a></p>
  
  <p>And this works.</p>
  
  <p>My test file is named /test/mySpec.js and my karma.conf.js file is on the root. I have moved around the JSON file to all of these locations with no luck. What am I doing wrong?</p>
  
  <p><strong>UPDATE WITH ANSWER:</strong></p>
  
  <p>Per the answer below, I added this to my karma.conf.js:</p>
  
  <pre><code>// fixtures
  { pattern: 'test/*.json',
      watched: true,
      served:  true,
      included: false
  }
  </code></pre>
  
  <p>Then, I wrote my test this way:</p>
  
  <pre><code>    var json:any;
      it("should load a fixture", function () {
          jasmine.getFixtures().fixturesPath = "base/test/"
          var f = readFixtures("registration.json");
          json = JSON.parse(f);
          expect(json).toBeDefined();
  
      })
  
      it("should have a title", function () {
          expect(json.title).toNotBe(null);
      })
      etc...
  </code></pre>
  
  <p>And it passes.</p>