Nearshore Development Company | VAIRIX

Testing AngularJS with Karma-Jasmine (part 1)


Unit testing as the name implies is about testing individual units of code. Unit tests try to answer questions such as "Did I think about the logic correctly?" or "Does the sort function order the list in the right order?"


A small, short and ugly step by step:

  1. sudo npm install -g generator-karma
  2. sudo npm install grunt-karma
  3. sudo npm install -g node-gyp
  4. https://github.com/karma-runner/grunt-karma
  5. npm install grunt-karma --save-dev
  6. npm install karma-jasmine --save-dev
  7. npm install karma-phantomjs-launcher --save-dev
  8. Configure karma.conf.js (http://nathanleclaire.com/blog/2013/12/13/how-to-unit-test-controllers-in-angularjs-without-setting-your-hair-on-fire/)
  9. Download files (https://code.angularjs.org/1.0.6/)


I know that it's short, but every good story has a humble beginning... follow us to see the second part!


Check out our News page: