Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "There is no server listening on port 9876" error while running karma?

You should use karma start command to execute karma test suite from command line.


They changed the delivery model for Karma recently

To install Karma itself, as you have already done:

npm install karma -g

But then you need to install drivers for testing frameworks. For example for QUnit

npm install karma-qunit --save-dev

Next you have to install launchers for the different browsers. For example Chrome and IE

npm install karma-ie-launcher --save-dev
npm install karma-chrome-launcher --save-dev

And now you should be good to go.

Now simply launch karma by using the start command with the config file as an input

karma start path/to/tests/karma.conf.js