I'm currently looking for TDD with CoffeeScript and JsTestDriver, however, I'm stuck on a ReferenceError released by JsTestDriver.
Some information:
- Using IntelliJ JsTestDriver Plugin
- Testing through Chrome
- The configured JsTestDriver is the same as on: http://code.google.com/p/js-test-driver/wiki/QUnitAdapter
- Writing Tests in CoffeeScript
- CoffeeScript is compiled in javascript and placed in the configured directories before running the test.
Config
server: http://Mark-PC:9876/capture load: - js/lib/main/*.js - js/lib/test/sinon.js - js/lib/test/qunit.js - js/lib/test/equiv.js - js/lib/test/QUnitAdapter.js - js/coffee/main/controllers/*.js - js/coffee/main/models/*.js - js/coffee/test/controllers/*.js
controller
class PortfolioController extends Backbone.Controller constructor: -> test: (a, b) -> return a + b
Test code
module("PortfolioController", { setup: -> @routeSpy = sinon.spy() teardown: -> window.location.hash = "" }) test 'indexRoute', -> c = new PortfolioController equals c.test(1, 1), 2, "1 + 1 = 2"
Problem
JsTestDriver throws an error
ReferenceError: PortfolioController is not defined ReferenceError: PortfolioController is not defined at Object. (http://mark-pc:9876/test/js/coffee/test/controllers/PortfolioController.test.js:12:5) at [object Object].test indexRoute (http://mark-pc:9876/test/js/lib/test/QUnitAdapter.js:40:15)
I tried:
- Removing dependencies like jQuery, BackBone, etc.
- Remote Qunit adapter and tried using jstestdriver statements
- A class is added inside the test itself, then it worked
Sounds like some kind of export problem or prototype conflict?
source share