If you are new to AngularJS, you might first want to watch my Getting to know AngularJS video.
Node packages to install:
npm install -g karma-cli
npm install -g karma --save-dev
npm install -g phantomjs
npm install -g karma-jasmine --save-dev
npm install -g karma-phantomjs-launcher --save-dev
npm install -g karma-chrome-launcher --save-dev
Install the last one only if you plan to run your unit tests using Chrome; you don’t need it if you prefer running them only in PhantomJS. Now, create the karma configuration file.
karma init karma2.conf.js
To run karma: karma start karma2.conf.js
For code coverage:
npm install -g karma-coverage
Make the changes as shown in the video and run karma as shown above.
Code sample here.