I am trying to implement a very simple unit test for CoffeeScript / JavaScript with JsTestDriver . I have two files:
1.) lib / Greeter.coffee
greet = (name) -> "Hello #{name}"
2.) lib / GreeterTest.coffee
tests = { "Test 1": -> assertEquals("Hello World!", greet "World") } TestCase("Test for introducing the test framework", tests)
My jsTestDriver.conf determines its path using the line: - lib/*.js However, when I run the test, I get: Total 0 tests (Passed 0; Fails: 0; Errors: 0)
I am sure that a test can be found because inserting an obvious program error leads to the detection of this error in a specific file. Also, inserting a warning call leads to the expected behavior: in the captured browser I see a warning message box
Am I missing something? How can you debug this?
Which works, but looks like this:
TestCase("Test case 1", { testGreet: -> greeter = new Greeter assertEquals("Hello World!", greeter.greet "World") })
and
class @Greeter constructor: -> greet: (name) -> return "Hello #{name}!"
If both files are in the same folder, you can leave @
source share