Embracing the Messiness in Search of Epic Solutions

Why I Am Switching to Karma




JavaScript testing is hard. Most of the time, it is just plain difficult to set up the test harness just to run Javascript tests.


Most of my team’s existing production web applications do not use any MV* frameworks. A few newer projects use Backbone/Marionette.

We rely on the following stack:-

We choose this direction because these Maven plugins provide good integration with Jenkins.

What is Wrong with the Current State


We will now rely on the following stack:-

Why This is a Better State

  • Developed by Google developers, primary test harness for AngularJS.
  • Allows us to use Jasmine 2.x.
  • Test framework agnostic. Although we are using Jasmine now, we can easily switch to Mocha in the future.
  • MV* framework agnostic. It works with any MV* or homegrown framework.
  • Great integration with Jenkins.
  • Great integration with IntelliJ.
  • Ability to run tests on different browsers at the same time, such as Chrome, Firefox, PhantomJS, etc.


2 responses to “Why I Am Switching to Karma”

  1. Prashanth Avatar


    Thanks for your post. I have some question regarding your initial project setup. We have exactly same setup as yours in the first case where we are using phantomjs driver with jasmine and we want to enable code coverage for the same using “code saga” plugin. But, whatever we tried, we are not able to succeed. Could you please send me the part of pom.xml where this coverage and jasmine is configured?


    1. Choon-Chern Lim Avatar

      We don’t use “code saga” plugin anymore. Instead, we switched to Yahoo’s Istanbul code coverage. In my pom.xml, we use maven-karma-plugin to kick start Karma.. see this post for example: http://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/

Leave a Reply