Karma: inactive browser

I try Karma for the first time, and after a few hours I still can’t get it to work.

When I run the test by typing karma start karma.conf.js in the terminal, a browser window will open and display the following (I also tried with Chrome with the same result):

enter image description here

This is the terminal output:

 29 07 2015 16:27:12.835:INFO [karma]: Karma v0.13.3 server started at http://localhost:9876/ 29 07 2015 16:27:12.852:INFO [launcher]: Starting browser Firefox 29 07 2015 16:27:15.866:INFO [Firefox 33.0.0 (Windows 7 0.0.0)]: Connected on socket HA1RSN-QsWuAO7NIAAAA with id 26755366 

My karma.conf.js file is located at the root of my Node.js project and looks like this:

 module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ 'tests/unit/test.js' ], exclude: [], preprocessors: {}, reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: false, browsers: ['Firefox'], singleRun: false }) } 

My test.js file looks like this (sample test from the book, my actual tests will be Angular.js tests):

 describe("First Test", function () { var counter; beforeEach(function () { counter = 0; }); it("increments value", function () { counter++; expect(counter).toEqual(1); }); it("decrements value", function () { counter--; expect(counter).toEqual(0); }); }); 

I am using Node.js version 0.12.05.

I appreciate any help as I really get lost here.

+6
source share
1 answer

You need to run a test run if you want to run it. There are two ways to do this:

  • Run karma run karma.conf.js in the second terminal window in the same working directory
  • Change the singleRun parameter to true so that it starts, runs a test, and exits.
+10
source

All Articles