You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The Mocha action in Continua is a wrapper around the Mocha command line. If you're having trouble using the Mocha action, please refer to the Mocha Command Line Usage.

 

The Mocha action is used to unit test Javascript running on node.js

Name

A friendly name for this action (will be displayed in the actions workflow area).

Enabled

Determines if this action will be run within the relevant stage.

Interface

The domain specific language or interface you are using in your tests. Choose either the BDD, TDD, Exports, QUnit and Require-style interface.  

Working Directory

Where to run the Mocha command line. Mocha will look for tests in a 'test' subfolder under the working directory.

Test Files

Paths or ANT patterns matching one or more test files.

Recursive

Tick this to look for text files in subdirectories of the 'test' folder

Report File

Where to save the test results. Path can be full or relative to working directory. Note that test results will be stored in XUnit format.

Using

The Using drop down is populated with any property collector whose namespace matches the pattern defined by the Mocha Action. The pattern for this action is ^Mocha.*

If you create a property collector for this action, make sure you select the Path Finder PlugIn type and give it a name that will match the pattern above in blue. 

For more in-depth explanations on property collectors see Managing Property Collectors.

Alternatively, you can select the Custom option from the Using drop down list and specify a path in the resulting input field that will be displayed. Please read Why it's a good idea to use a property collector before using this option.

Filters / Modules

 

Test Filters

Use this to filter tests to those containing a specific string or one of a list of strings. The match is case-sensitive with one filter string per line.

Use regular expressions

Tick this to treat each test filter string as a regular expression.

Invert filters 

Tick this to us the filter strings to exclude tests. Only tests not macthing any of the strings (or regular expressions) will be processed.

Required Modules

Specify any modules required for all tests which you do not need to reference e.g. ones which support existing references. One module per line.

Options

 

Options File

Path to the Mocha options file. Leave blank to use no options file or default to test/mocha.opts relative to working directory.

Compilers

A Comma-delimited list of compiler modules to use to compile files.

Async only

Tick this to force all tests to take a asynchronous callback..

Show full stack trace

Tick to show full stack trace in the report file.

Expose gc extension

Tick to expose the Javascript garbage collector to your tests so you can, for example, force garbage collection.

Fail action if any tests fail

Tick this to cause the build to fail if any tests fail.

Fail action if any tests error

Tick this to cause the build to fail if an error occurred while running any test.

Check for global variable leaks

Tick to check for any global variable leaks during tests.

Accepted Global Variables

Comma-delimited list of accepted global variable names. You can use * as a wildcard.  Leave empty to check all globals. Use '*' to ignore all globals.

Timeout (ms)

Specify the time to wait for a test to finish. If the test does not finish before the timeout the the test will fail. Enter zero for no timeout.

Bail

Tick to exit action if one test fails without running any further tests.

h before the timeout the the test will fail. Enter zero for no timeout.

Pre-install Mocha to working directory using NPM

Mocha needs to be installed to the working directory before the tasks can be run. Tick this to automatically install Mocha before running the Mocha command line. Leave this cleared if you are installing Mocha with a separate preceding NPM action

Environment Variables

Multiple environment variables can be defined - one per line. These are set before the Mocha command line is run.

  • No labels