title: jasmine typeError is not a function
body: <p>I'm gonna build a node.js app an I was looking for unit testing on JS.
  So I tried <strong>Jasmine</strong>, seems to be fun and cool at use.</p>
  
  <p>Well I've a spec File : <strong>UserSpec.js</strong></p>
  
  <pre><code>var userClass = require('../src/users.js');
  var utils = require('../src/utils.js');
  describe("Users tests", function() {
  
      var usernameTest = "usernameTest";
      var emailTest = "emailTest";
      var passwordTest ="passwordTest";
      var myUser = userClass.create('usernameTest','emailTest','passwordTest');
  
      /**********
      *   TDD   *
      **********/
      it("is not null", function() {
          expect(myUser).not.toBe(null);
      });
      it("username not null", function() {
          var username = myUser.username;
          expect(username).not.toBe(null);
      });
      it("is a string", function() {
          var usernameType = typeof myUser.username;
  
          expect(usernameType).toEqual("string");
      });
      it("correct username", function() {
          var username = myUser.username;
          expect(username).toEqual(usernameTest);
      });
      it("mail not null", function() {
          var email = myUser.email;
          expect(email).not.toBe(null);
      });
      it("correct mail", function() {
          var email = myUser.email;
          expect(email).toEqual(emailTest);
      });
      it("password not null", function() {
          var password = myUser.password;
          expect(password).not.toBe(null);
      });
      it("password is encrypted", function() {
          var password = myUser.password;
          expect(password).toEqual(utils.encrypt(password));
      });
      //TODO: User BDD (CRUD)
  </code></pre>
  
  <p>when I run it by console with cmd by : </p>
  
  <pre><code>jasmine-node UserSpec.js
  </code></pre>
  
  <p>I got this : </p>
  
  <pre><code>D:\workspace\MyDL-NodeServer\spec&gt;jasmine-node UserSpec.js
  FFFFFFFFF
  
  Failures:
  
    1) is not null
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Object.jasmine.executeSpecsInFolder (C:\Users\Azrael\AppData\Roaming\npm\node_modules\jasmine-node\lib\jasmine-node\index.js:168:16)
      at Object.&lt;anonymous&gt; (C:\Users\Azrael\AppData\Roaming\npm\node_modules\jasmine-node\lib\jasmine-node\cli.js:248:9)
      at Module._compile (module.js:460:26)
      at Object.Module._extensions..js (module.js:478:10)
  
    2) username not null
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    3) is a string
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    4) correct username
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    5) mail not null
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    6) correct mail
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    7) password not null
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    8) password is encrypted
     Message:
       TypeError: undefined is not a function
     Stacktrace:
       TypeError: undefined is not a function
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\SpecHelper.js:2:11)
      at Timer.listOnTimeout (timers.js:119:15)
  
    9) password is encrypted
     Message:
       Expected 'c9a7773c3a130e3ca370dad6' to equal 'daff65787a4b4f3bc47498911683901d85c88294dd1495c5'.
     Stacktrace:
       Error: Expected 'c9a7773c3a130e3ca370dad6' to equal 'daff65787a4b4f3bc47498911683901d85c88294dd1495c5'.
      at null.&lt;anonymous&gt; (D:\workspace\MyDL-NodeServer\spec\UserSpec.js:47:20)
      at Timer.listOnTimeout (timers.js:119:15)
  
  Finished in 0.037 seconds
  8 tests, 18 assertions, 9 failures, 0 skipped
  </code></pre>
  
  <p>Well , all my tests are executed, and they all fail, ok it's correct TDD circle, but all theses tests should pass. I can't get why I've got this multiple error : </p>
  
  <pre><code> TypeError: undefined is not a function 
  </code></pre>
  
  <p>My two scripts are really imported (the user is well created , and the encrypt() method is really called), so i can't figure what's going wrong</p>
  
  <p>Does someone have an idea of the source of the bug ?</p>