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.

victorleungtw

Years of experience delivering enterprise projects with global stakeholders in banking, airline and gaming industries involving a broad range of technologies. Provide consulting services at both executive and operational levels, including strategy and data analysis. Lead web and mobile app development team with hands-on coding implementation. Manage projects as Certified Scrum Master with Agile techniques. Qualification with master degree in Computer Science and pursuing MBA degree in Finance.

Leave a Reply

Close Menu