Configure CircleCI with Karma test

December 22, 2014

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

Profile picture

Experience in software development, application architecture, and deploying cloud solutions for enterprise customers. Strong hands-on skills with a Master's degree in Computer Science and business acumen with a master of business administration (MBA) in Finance. Certified in Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, Kubernetes (CKA, CKAD, CKS, KCNA) and Scrum (PSM, PSPO) with experience in building banking products from scratch. Connect on Linkedin

© 2022, @victorleungtw