Book Image

Learning Single-page Web Application Development

Book Image

Learning Single-page Web Application Development

Overview of this book

Table of Contents (15 chapters)
Learning Single-page Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring Karma (unit testing)


Karma is configured with a file called karma.conf.js.

Tip

You can find more information about Karma at http://karma-runner.github.io/0.12/index.html.

The easiest way to create this file is to use the karma-cli tool. This way, you will have the init command available in your terminal. This is a standard procedure used in many tools available for Node.js environments, such as Grunt, Bower, and some others.

Command line interface (CLI) helps us to create files and settings in a simple and fast way using the terminal. As we already have the karma.conf.js file, we don't need to perform the init command.

Open the project folder. Now, let's review the karma.conf.js file to understand it line by line:

'use strict';

/**
 * Module dependencies.
 */
var applicationConfiguration = require('./config/config');

// Karma configuration
module.exports = function(config) {
  config.set({
    // Frameworks to use
    
frameworks: ['jasmine']
,

    // List of files / patterns...