title: Grunt-Karma: Use Node.js fs-framework in Jasmine Testfile
body: <p>I'm writing unit-tests with the Jasmine-framework.</p>
  
  <p>I use Grunt and Karma for running the Jasmine testfiles.</p>
  
  <p>I simply want to load the content of a file on my local file-system (e.g. example.xml).</p>
  
  <p>I thought I can do this:</p>
  
  <pre><code>var fs = require('fs');
  var fileContent = fs.readFileSync("test/resources/example.xml").toString();
  console.log(fileContent);
  </code></pre>
  
  <p>This works well in my Gruntfile.js and even in my karma.conf.js file, but not in my
  Jasmine-file. My Testfile looks like this:</p>
  
  <pre><code>describe('Some tests', function() {
      it('load xml file', function() {
          var fs = require("fs");
          fileContent = fs.readFileSync("test/resources/example.xml").toString();
          console.log(fileContent);
      });
  }); 
  </code></pre>
  
  <p>The first error I get is: </p>
  
  <pre><code>'ReferenceError: require is not defined'.
  </code></pre>
  
  <p>Does not know why I cannot use RequireJS here, because I can use it
  in Gruntfiel.js and even in karma.conf.js?!?!? </p>
  
  <p>Okay, but when manually add require.js to the files-property in karma.conf.js-file,
  then I get the following message:</p>
  
  <pre><code> Module name "fs" has not been loaded yet for context: _. Use require([]) 
  </code></pre>
  
  <p>With the array-syntax of requirejs, nothing happens.</p>
  
  <p>I guess that is not possible to access Node.js functionality in Jasmine when running the
  testfiles with Karma. So when Karma runs on Node.js, why is it not possible to access the 'fs'-framework of Nodejs? </p>
  
  <p>Any comment/advice is welcome.
  Thanks.</p>