title: Could not find my javascript classes built from Typescript
body: <h2>Situation</h2>
  
  <p>I am working on the frontsside of a webapp with typescript that I compile into JS. I want to run qunit test on the js that is generated. My typescript is merge  in one file using <a href="http://browserify.org/" rel="nofollow noreferrer">browserify</a> I want to run test upon my js object. I am runing the js without node in a tomcat webserver using a war package.</p>
  
  <h2>Problem</h2>
  
  <p>I could not find the classes js that I have generated (problem of access or hidden object....) ? Animal class is not accessible when I try to use animal.js in a js script!? How to access this class in a js? <strong>I want to run with no errors, animal.test.html.</strong></p>
  
  <p><strong>animal.ts</strong></p>
  
  <pre><code>export class Animal {
  
      name:string;    
  
      constructor(name:string) {
          this.name=name;
      }
  
      public run(){
          console.log('${this.name}:Animal runs.');
      }
  
      public eat(){
          console.log('${this.name}:Animal eats.');
      }
  
      public sleep(){
          console.log('${this.name}:Animal sleeps.');
      }
  }
  </code></pre>
  
  <p><strong>animal.js</strong> <em>(from animal.ts)</em></p>
  
  <pre><code>(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&amp;&amp;require;if(!u&amp;&amp;a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&amp;&amp;require;for(var o=0;o&lt;r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  "use strict";
  var Animal = (function () {
      function Animal(name) {
          this.name = name;
      }
      Animal.prototype.run = function () {
          console.log('${this.name}:Animal runs.');
      };
      Animal.prototype.eat = function () {
          console.log('${this.name}:Animal eats.');
      };
      Animal.prototype.sleep = function () {
          console.log('${this.name}:Animal sleeps.');
      };
      return Animal;
  }());
  exports.Animal = Animal;
  },{}]},{},[1]);
  </code></pre>
  
  <p><strong>animal.build.js</strong></p>
  
  <pre><code>var browserify = require('browserify');
  var tsify = require('tsify');
  
  browserify()
      .add('src/test/typescript/animal.ts')
      .plugin(tsify, { noImplicitAny: true })
      .bundle()
      .on('error', function (error) { console.error(error.toString()); })
      .pipe(process.stdout);
  </code></pre>
  
  <p><strong>Build run command</strong>
  I use node with browserify as referenced in the <a href="https://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html" rel="nofollow noreferrer">typescript lang</a> site</p>
  
  <pre><code>node animal.js &gt;  src/test/typescript/animal.js
  </code></pre>
  
  <p><strong>animal.test.js</strong></p>
  
  <pre><code>QUnit.module( "Form test" );
  
  QUnit.test( "hello test2", function( assert ) {
   var a = new Animal("toto"); 
  
    assert.ok( a!==undefined &amp;&amp; a!=null);
  });
  </code></pre>
  
  <p><strong>animal.test.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width"&gt;
    &lt;title&gt;QUnit Example&lt;/title&gt;
    &lt;link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-1.23.0.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="qunit"&gt;&lt;/div&gt;
    &lt;div id="qunit-fixture"&gt;&lt;/div&gt;
  
    &lt;script src="https://code.jquery.com/qunit/qunit-1.23.0.js"&gt;&lt;/script&gt;
    &lt;script src="animal.js"&gt;&lt;/script&gt;
    &lt;script src="animal.test.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Qunit response</strong> 
  <a href="https://i.stack.imgur.com/pmpRM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pmpRM.jpg" alt="qunit animal ko!"></a></p>