Chutzpah 2.1 now with CoffeeScript support

Chutzpah 2.1 is now available. This release contains a few new features but most notable is that Chutzpah can now work directly on CoffeeScript files. You can enjoy the new bits from CodePlex, NuGet or go to the Visual Studio Gallery to get the updated Visual Studio Context Menu Extension  and Unit Test Explorer adapter for Visual Studio 2012.

Changes

  • Added support for writing tests in coffee script (item 58)  – More details below
  • Added option to ouput test results to XML file (item 57)
  • Changed chutzpah.console.exe output to support VS error list integration (item 48)
  • Tests complete doesn’t match total when using parallelism (item 59)

More about CoffeeScript Support

Chutzpah now supports running unit tests you write in the CoffeeScript language. Chutzpah will automatically generate temporary JavaScript files for your referenced CoffeeScript files and use those to gather the test results.
For example given a CoffeeScript test file that references another CoffeeScript file:

## <reference path="../code/code.coffee" />

test "A basic test", ->
  ok true, "this test is fine"
  value = "hello"
  equal "hello", value, "We expect value to be hello"

It will parse that file as well as the referenced code.coffee file and generate corresponding .js files. Notice the syntax for referencing other files. For CoffeeScript files Chutzpah uses comments that start with ## to indicate a reference declaration.

 

12 thoughts on “Chutzpah 2.1 now with CoffeeScript support

  1. Hello Matthew,

    I’ve just started to trial Chutzpah 2.2.1 for tests within Visual Studio 2010 and it’s all working well as is the Command Line Console with JavaScript. I’m having a problem getting the CoffeeScript tests to work however.

    I’ve followed your example, creating a test.coffee file (in the same folder as the console exe) containing your standard test(s).I then run “chutzpah.console.exe test.coffee” which completes successfully but doesn’t show any tests having been run. When the same script compiles in VS2010 to a js file all it contains is an empty closure.

    Am I doing something obvious wrong?

    Thanks in Advance

    1. Hello

      In an attempt to get it to work, I’ve reverted to the example you gave with the following (so not now calling anything in my ‘code.coffee’).

      ##

      test “Test written in Coffee Script”, ->
      ok true, “this test is fine”
      value = “hello”
      equal “hello”, value, “We expect value to be hello”

      Thanks for taking a look at this
      John

    2. The reference path has been lost when I pasted the contents of the file. It just has a reference to “code.coffee”.

  2. I gave that a try but got the same result as before (output pasted below).
    Do i need anything extra for CoffeeScript or is everything required within the directory structure from the Chutzpah download?

    Thanks

    >chutzpah.console.exe test.coffee
    Chutzpah console test runner (32-bit .NET 4.0.30319.269)
    Copyright (C) 2012 Matthew Manela (http://matthewmanela.com).

    chutzpah.dll: Version 2.2.1.173

    === 0 total, 0 failed, took 0.00 seconds ===

  3. Hello,

    I’ve tried the Coffee Script test on XP, Windows 7 and Server 2008. It only worked on Windows 7. It may be that the OS is the issue or perhaps some related problem?

    Thanks
    John

    1. Hmm I am not sure. Chutzpah relies on a program called PhantomJS. I want to try to figure out if that works for you. That exe is included in the Chutzpah package. Can you from a command line run “phantomjs.exe -v” and this should succesfully print out the version of PhantomJS without hanging or throwing an exception.

      Can you let me know the results of that?

Comments are closed.