Configure CircleCI with Karma test

The Problem

I was setting up continuous integration using CircleCI with karma test for Angular on Heroku. The test was working on local host, but karam 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

Create or edit your circle.yml config file, add dependencies by using npm to install karma-cli globally, use bower to install angular as well as shown below:

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

Originally published at victorleungtw.com on December 22, 2014.

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.