title: Require.JS and JS Test Driver: Unexpected token <
body: <p>I am trying to test a simple Backbone Model loaded via RequireJS: </p>
  
  <pre><code>define ["backbone"], (Backbone)-&gt;
  
      class Todo extends Backbone.Model 
          defaults:
              title: ''
              priority: 0
              done: false
  
          validate: (attrs) -&gt; 
              errs = {}
              hasErrors = false
  
              if (attrs.title is "")
                  hasErrors = true
                  errs.title = "Please specify a todo"
  
              if hasErrors
                  return errs
  
          toggleDone: -&gt;
              @save("done", !@get("done"))
  
      return Todo
  </code></pre>
  
  <p>My tests look like: </p>
  
  <pre><code>requirejs.config 
      baseUrl: "js/"
      paths: 
          jquery: "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min"
          jqueryui: "https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min"
          json2: "http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2"
          underscore: "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min"
          backbone: "http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min"
          backboneLocalStorage: "https://raw.github.com/jeromegn/Backbone.localStorage/master/backbone.localStorage-min"
      shim: 
          "underscore":
              exports: "_"
          "backbone": 
              deps: ["jquery", "underscore", "json2"]
              exports: "Backbone"
          "jqueryui": 
              deps: ["jquery"]
          "backboneLocalStorage":
              deps: ["backbone"]
              exports: "Backbone.LocalStorage"
  
  require ["models/todo"], (Todo) -&gt;
  
      console.log Todo
  
      TodoTests = TestCase("TodoTests")
  
      TodoTests::testCreateTodo = -&gt; 
          todo = new Todo({ title: "Hello" })
          assertEquals "Hello", todo.get("title")
          assertEquals 0, todo.get("priority")
          assertEquals false, todo.get("done")
  </code></pre>
  
  <p>The JS Test Driver config: </p>
  
  <pre><code>server: http://localhost:3001
  
  load:
    - ../public/js/libs/require.js
    - ../public/js/tests.js
  
  serve:
    - ../public/js/models/*
    - ../public/js/collections/*
    - ../public/js/views/*
  </code></pre>
  
  <p>Problem seen from the JS Test Driver listened page on Chrome console: </p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token &lt;</p>
  </blockquote>
  
  <p>Looking at Todo.js from Chrome, </p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Console Runner&lt;/title&gt;&lt;script type="text/javascript"&gt;var start = new Date().getTime();&lt;/script&gt;
  Uncaught SyntaxError: Unexpected token &lt;
  &lt;script src="/static/lib/json2.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script src="/static/lib/json_sans_eval.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script src="/static/jstestdrivernamespace.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script src="/static/lib/jquery-min.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script src="/static/runner.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;jstestdriver.runConfig = {'debug':false};&lt;/script&gt;
  &lt;script type="text/javascript"&gt;jstestdriver.console = new jstestdriver.Console();
  </code></pre>
  
  <p>Notice its a HTML page instead of my actual JS. Also <code>console.log(Todo)</code> returns <code>undefined</code> since a HTML page is returned in place of a JS. Did I configure this wrongly?</p>