Pages

Monday, May 05, 2014

Resolving issue with Yeoman-generated Angular web project and the jasmine framework provider

I'm kicking off a new Angular web client project today and I'm using Yeoman to get me up and going here. Seems the angular-generator for Yeoman doesn't properly link in the plugins needed for running Jasmine specs within karma, reported on this StackOverflow question. Add the following to your karma.conf.js file in the project root directory:
plugins: [
    'karma-jasmine',
    'karma-coverage',
    'karma-junit-reporter',
    'karma-phantomjs-launcher',
    'karma-chrome-launcher',
    'karma-safari-launcher',
    'karma-firefox-launcher',
    'karma-ie-launcher'
],
I also needed to install these node packages and save the configuration to the package.json file:
npm install karma-jasmine --save-dev
npm install karma-coverage --save-dev
npm install karma-junit-reporter --save-dev
npm install karma-phantomjs-launcher --save-dev
npm install karma-safari-launcher --save-dev
npm install karma-firefox-launcher --save-dev