Chutzpah File References

One of the most important steps to having Chutzpah successfully run your tests is to set up your file references correctly. You accomplish this in two ways. One is adding a special file reference comment at the top of your files:

/// <reference path="someDependency.js" />

When Chutzpah sees this it will include that file in the generated test harness as well as recursively scan that file to find all of its references.

If you want to include a whole directory of files you can just specify a folder:

/// <reference path="some/folder" />

Chutzpah will the recursively scan that folder to find all references.

The other way to add references is using the references setting in the Chutzpah.json Settings File:

    "References": [
        { "Path": "someDependency.js" },
        { "Path": "some/folder", "Include": "*.js", "Exclude": "*Resource*" }

Excluding References

The reference syntax is also used by VS to give intellisense in JS files. This leads to an issue since sometimes you may reference a version of a file just for intellisense but you do not want Chutzpah to copy it. In this case you can include the chutzpah-exclude attribute to have it ignored by Chutzpah:

/// <reference path="someDependency.js" chutzpah-exclude="true" />

Alternate Reference Syntax

The reference syntax is also used by the TypeScript compiler for referencing files. This can cause an issue since Chutzpah expects you to reference your implementation files and TypeScript excepts you to reference your definition files. To mitigate this issue you can use a Chutzpah specific version of the reference command:

/// <chutzpah_reference path="someDependency.js" />

This works the same as the other syntax except that TypeScript (and VS) will ignore it.

Root Reference Path Mode

If you write a reference path like
/// <reference path="someDependency.js" />
then Chutzpah searched for that dependency relative to the current file. However, you can also specify a reference path like

/// <reference path="/someDependency.js" />

The beginning forward slash will tell Chutzpah to find that file at the root of the drive the file is in (e.g C:\). This behavior is configurable using a chutpah.json file. For example if you want the rooted reference path to be relative to a different directory you can place the a chutzpah.json file in that directory with the following content:


Click this link to lean more of the Chutzpah.json Settings File

Last edited Dec 13, 2013 at 6:05 AM by mmanela, version 5