Chutzpah 2.3 Released

This release contains a couple important new features and bug fixes. Chutzpah now gives you more control in how you want youe tests run using the new chutzpah.json settings file (described in detail below).

You can get 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 and Fixes

  • Added Chutzpah.json settings file support
  • Consistent conversion error (item 70)
  • System.IO.IOException: The handle is invalid when running from inside WebStorm (item 77)
  • Exception has been thrown by the target of an invocation. inside Visual Studio 2012 (item 65)
  • Tests are hanging (ChutzpahTimeoutException) (item 72)
  • Reference root path should be project (item 83)
  • Smarter coffeescript compilation (item 75)
  • Running with parallelism gives faulty timing (item 81)
  • Running with parallelism gives System.IO.IOException (item 74)
  • Compile all TypeScript files at the same time (item 82)

The Chutzpah Settings File

The Chutzpah settings file is an .json file that you can place anywhere in your testing directories to inform Chutzpah of test specific settings. The Chuzpah settings file is completely optional and if the file or any of its properties are omitted Chutzpah will use the default values.

When Chutzpah is run on a file (lets say test.js) it scans the current directory for a file named chutzpah.json. If it does not find one it will recursively traverse up the directory chain looking for one. This behavior provides a lot of flexibility since you can provide multiple chutzpah.json files in your tree and each one will work over its sub-folder. This lets you have different settings for different groups of tests.

Chutzpah.json Format

The settings file is a text file with json content of the following format:

{
    "Framework": "qunit|jasmine",

    "TestHarnessLocationMode": "TestFileAdjacent|SettingsFileAdjacent|Custom",

    "TestHarnessDirectory": "<Path to a folder>",

    "TypeScriptCodeGenTarget" : "ES3|ES5",

    "RootReferencePathMode":"DriveRoot|SettingsFileDirectory"
}

The chutzpah.json file supports the following properties

Framework – Determines what testing framework to use. This will override the other detection methods. This is helpful if Chutzpah is having trouble figuring out what your intended framework is. If left out Chutzpah will automatically try to detect the framework.

TestHarnessLocationMode – Determines where to place the generated html test harness files. The default mode is TestFileAdjacent which means the harness is placed in the same directory as the test file. SettingsFileAdjacent means it is placed in the same directory as the chutzpah.json file. Custom mode lets you specify a custom path to the directory.

TestHarnessDirectory – When TestHarnessLocationMode is set to Custom this is either the relative or absolute path to the directory where to place the test harness.

TypeScriptCodeGenTarget – When running on a TypeScript file this property will tell the TypeScript compiler what type of code to generate. ES3 is for ECMAScript 3 and ES5 is for ECMAScript 5.

RootReferencePathMode – This property determines what directory a rooted reference path refers to. In a test file Chutzpah parses the <reference path=”” /> tags to determine your test dependencies. By default  (the DriveRoot setting) if you write <reference path=”\a.js” /> Chutzpah will look for a.js under C:\ (assuming you are running your test in the C drive). However, if you set this property to SettingsFileDirectory Chutpah will now look for a.js relative to the location of the chutzpah.json file. This is useful if you have a large project and want to minimize the number of long reference paths.

Examples:

This file tells Chutzpah to use QUnit and to place the test harness next to the chutzpah.json file:

{
    "Framework": "qunit",
    "TestHarnessLocationMode": "SettingsFileAdjacent"
}

 

This file tells Chutzpah to convert TypeScript to ES5 code and to place the test harness in a custom directory:

{
    "TypeScriptCodeGenTarget" : "ES5",
    "TestHarnessLocationMode": "Custom",
    "TestHarnessDirectory": "../Some/Folder"
}