Test AngularJS with Karma and Jasmine

I installed on windows karma and karma-jasmine in the same folder. I run then in console
karma init
karma start
I get on Chrome this:

then in my console I get this:

I don’t know were to put my file controller.js to be test it.


angular.module('notesApp', []).controller('ListCtrl', [ function(){
	var self = this;
	self.items = [
		{id: 1, label: 'First', done: true},
		{id: 2, label: 'Second', done: false}

	self.getDoneClass = function(item) {
		return {
			finished: item.done,
			unfinished: !item.done

I tried to put in the browser like this


but does’t work. Can someone help me?

I had to put the question on other forums too, to find the answer. After a lot of hours of trying and errors like
ReferenceError: controller is not defined
Uncaught ReferenceError: angular is not defined

Someone told me to put all the files in the karma.conf.js file. So I add it my controller.js file(that I want to test it) and angular.js file in this config file:

module.exports = function(config) {

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [

This app folder is inside Karma folder. I’m not sure that how I organized the folders is correct, but know works.
So when I have a error in the file, karma, in the real time, shows me the error(after I save the file), in the console.

I put the answer here, because nobody knew how to help me and I’m sure that others will fall into the same problems.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.