Skip to content

Karma Tests

Setup

The test suites require a small amount of setup. If your system was created via buildkit and civibuild, then it was handled automatically.

Karma is a Javascript testing tool which executes Jasmine tests on the command-line. It was introduced in Civi v4.6 in tandem with several AngularJS-based UIs.

Buildkit includes a copy of karma. Alternatively, you can download it by running npm install in the civicrm directory.

Running Karma

If you're actively working on Javascript files or Karma tests, then you can start karma in a watch mode. Any time you save a change to disk, it will automatically re-execute the tests.

$ cd /path/to/civicrm
$ karma start

Running Karma (Other ways)

You can also run the karma tests as they would be run by Jenkins using civi-test-run.