title: Testing a JavaScript File via Jasmine
body: <p>I am trying to learn how to unit test a JavaScript file with Jasmine. At this time, I have the following</p>
  
  <p><strong>/dist/MyJavaScriptFile.min.js</strong></p>
  
  <pre><code>function MyClass() {}
  module.exports = MyClass;
  
  MyClass.prototype.test = function(msg) {
      console.log(msg);
  };
  </code></pre>
  
  <p>I want to test the functions in this class using Jasmine. In an attempt to do this, I have the following:</p>
  
  <p><strong>/test/unit/MyJavaScriptFile.spec.js</strong></p>
  
  <pre><code>describe('MyClass', function() {
      beforeEach(function() {
          module('MyClass');
      });
  
      describe('Test', function () {
          it('should write a message', function() {
            MyClass.test('hello from the test.');
          });
      });
  });
  </code></pre>
  
  <p>When I attempt to run these tests, from Gulp, I get an error. The error is:</p>
  
  <pre><code>Failures: 
  1) MyClass Test should write a message
  1.1) TypeError: object is not a function
  </code></pre>
  
  <p>My belief is that this is happening because <code>/dist/MyJavaScriptFile.min.js</code> or <code>MyClass</code> is not loaded as a dependency. I thought I was doing that with the <code>module('MyClass');</code> line. However, I do not see how the .spec.js file or the Jasmine test runner would know the location of the definition of <code>MyClass</code>. What am I doing wrong?</p>