Posts

Showing posts from February, 2017

Getting started with Karma for AngularJS Testing

Image
Introducing Karma A tool called  Karma  is a JavaScript test runner created by the AngularJS team. Jasmine is the testing framework that we talked about in the  getting started with unit testing for AngularJS  post, and Karma provides helpful tools that make it easier to us to call our Jasmine tests whilst we are writing code. We’re going to rebuild the single page calculator app from the last post using Karma for the tests. Installing Karma You can read the full installation instructions  here  or we also summarise them below. The first step is to install Node.js: Install  Node.js NB the documentation states that:  Karma works on the two latest stable versions. That is 0.8.x and 0.10.x at this point.  However, I have Node.js v0.12.x and have yet to run into any problems. Node: For the following commands I assume use of Terminal for Mac or Command Prompt for Windows. Open the Terminal/Command Prompt and enter the following: mkdir CalculatorKarma cd CalculatorKarma