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

Karma is a test runner which executes JavaScript unit tests is one or more web browsers.

Karma

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.

Root Directory

The path to the root directory for running the karma action. Defaults to workspace folder.

Report File(s)

A list of one or more report files to import into Continua CI - one path per line. You can use Ant patterns to match multiple files. Note that The JUnit reporter will be used and all test results will be in JUnit format.

Using

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

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. Example names listed here, search the table's Plugin column for "Karma".

For more in-depth explanations on property collectors see 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.


Settings

Browser(s)

A list of browsers to run the Karma configuration against - one browser name per line. Leave blank to use those specified in the configuration.  Karma comes with launchers pre-installed for Chrome, Chrome-Canary, and PhantomJS. Ensure that you install any extra browsers using an NPM install action before running the Karma action. [--browsers]

Note that the Continua CI agents running as a Windows service cannot run browsers which require a UI. If you really must test against one of these browsers, stop any running the agent service and run the agent as a console using the -console flag. e.g. %ProgramFiles%\VSoft Technologies\ContinuaCI Agent\Continua.Agent.Service.exe -console.

Reporter(s)

A list of reporters to handle the Karma results. One name per line. Clear field to use those specified in the configuration. [--reporters]

Port

Specify the port that the Karma server will run on. [--port]

Capture Timeout (ms)

The maximum boot-up time allowed for a browser to start and connect to Karma in milliseconds. If any browser does not get captured within the timeout, Karma will kill it and try to launch it again and, after three attempts to capture it, Karma will give up. Enter zero to use the default from the configuration file. [--report-slower-than]

Slow Test Threshold (ms)

Report tests that are slower than the given time in milliseconds. Enter zero to use the default from the configuration file. [--capture-timeout]


Options

Pre-install Karma and karma-junit-reporter to working directory using NPM

Karma and the karma-junit-reporter both need to be installed to the working directory before the tests can be run. Tick this to automatically install the required files before running the Karma command line. Leave this cleared if you are installing Karma with a separate preceding NPM action.

NPM Packages

Visible only if the 'Pre-install Karma and karma-junit-reporter to working directory using NPM'  checkbox is ticked.

The packages to install to the working directory using NPM.

Run NPM Using

Visible only if the 'Pre-install Karma and karma-junit-reporter to working directory using NPM'  checkbox is ticked.

The property collector pointing to the location of the NPM.exe file.

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.

Fail action if any tests are inconclusive

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

Timeout (in seconds)

How long to wait for the action to finish running before timing out. Leaving this blank (or zero) will default to 86400 seconds (24 hours).

Treat failure as warning

Tick to continue build on failure marking the action with a warning status.

Ignore warnings

If this is ticked, any warnings logged will not mark the action with a warning status.


Environment

Environment Variables

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

Log environment variables

If this is ticked, environment variable values are written to the build log. 

Generate system environment variables

Tick this checkbox to set up a list of new environment variables prefixed with 'ContinuaCI.' for all current system expression objects and variables.

Mask sensitive variable values in system environment variables

This checkbox is visible only if the 'Generate system environment variables' checkbox is ticked.

If this is ticked, the values of any variables marked as sensitive will be masked with **** when setting system environment variables. Clear this to expose the values.