Configure CircleCI with Karma Test

December 22, 2014

The Problem

I was setting up continuous integration using CircleCI and Karma tests for Angular on Heroku.

2014 12 22

The tests were working on my local host, but Karma was not found on CircleCI:

Uh-oh, some tests have failed!
Failing command: npm test
Exit code: 1
Output:
> karma start karma.conf.js

sh: 1: karma: not found
npm ERR! Test failed. See above for more details.
((npm :test)) returned exit code 1

My Solution

To resolve this issue, either create or edit your circle.yml config file. Add dependencies using npm to install karma-cli globally, and use Bower to install Angular, as shown below:

dependencies:
  pre:
    - npm install -g karma-cli bower
    - bower install
  cache_directories:
    - ~/nvm

This configuration should help you run your Karma tests successfully on CircleCI.


Profile picture

Victor Leung, who blog about business, technology and personal development. Happy to connect on LinkedIn