This project is read-only.

Tests Setting

The tests setting allows you to specify which files/folders to use as test files. The tests setting section can be used in two ways: discovery or filtering.

For discovery you can tell chutzpah.console.exe to execute a chutzpah.json file. Chutzpah will evaluate the tests settings and use it to find all files it describes.

chutzpah.console.exe path/to/chutzpah.json


For filtering Chutzpah will skip test files which don’t match the tests setting. This is a much needed feature for the Visual Studio integration. By default the test adapter plugin will look at all *.js files and try to see if they are test files. Often Chutzpah is able to use heuristics to quickly tell if a file is a test file. If the heuristics fails it then needs to actually execute that file. This can be very slow especially if Chutzpah is doing this with a large JS library. With this tests setting feature you can help Chutzpah out by placing a chutzpah.json at the root of your project and indicate which files are the test files. This can be a big performance boost and is the recommendation for all projects.

Path The path to either a file or a folder. If given a folder, it will be scanned recursively. This path can be relative to the location of the chutzpah.json file.
Include This is an optional include glob pattern. This is used when the Path is a folder. Only files matching the Include pattern will be added.
Exclude This is an optional exclude glob pattern. This is used when the path is a folder. All files matching the exclude pattern will not be added.

Example:

This file shows a few different ways you can write the test settings.
{
    "Tests": [
        { "Include": "*test1*" },
        { "Path": "Dir3/test.js"},
        { "Path": "Dir1", "Include": "*.js", "Exclude": "*test4.js" },
        { "Path": "Dir2" }
    ]
}
  • Line #3 – Includes all tests that contain test1 in its path. This is in glob format.
  • Line #4 – Includes the file Dir3/test.js (relative to the chtuzpah.json path).
  • Line #5 – Includes all *.js files in the folder Dir1 except test4.js. (Include/Exclude in glob format)
  • Line #6 – Includes all files in Dir2

Last edited Mar 11, 2014 at 8:24 PM by mmanela, version 3