Lets have a clean Karma

Jupyter Data
1 min readDec 14, 2015

Setup Karma npm modules

>> npm install karma karma-jasmine karma-chrome-launcher --save-dev
// optional
// sudo npm install -g karma-cli

Initialize Karma config

>> karma init karma.config.js

In the config.js, make sure the angular files are loaded from the right path example as such

files: [
‘../../node_modules/angular/angular.js’,
‘../../node_modules/angular-mocks/angular-mocks.js’,
‘../../app/static/dist/static/js/*.js’,
‘**/*.tests.js’
],

Sample Test

‘use strict’;describe(‘TopMostController’, function () {
beforeEach(module(‘app’));
var topMostCtrl;
describe(‘TopMostController’, function () {
it(‘must have animations enabled’, inject(function ($controller) {
var $scope = {};
topMostCtrl = $controller(‘TopMostController’, { $scope: $scope });
expect(topMostCtrl.animationsEnabled).toBe(true);
}));
});
});

Start the karma runner:

>> karma start karma.config.js
// with --debug flag to get more information

References:
http://jasmine.github.io/2.0/introduction.html

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Jupyter Data
Jupyter Data

Written by Jupyter Data

Fastest way to Explore your Data

No responses yet

Write a response