Why are my AngularJS, Karma / Jasmine tests running so slowly?

The answer turns out to be very simple.

I am using Chrome to run the karma server. When you first start the karma server an instance of Chrome is started as a maximised window. So naturally you minimise this so you can see your tests running.

The problem is that Chrome starves any minimised or secondary tabs (switched tabs) of CPU cycles.

Therefore, if you minimise the browser instance running the karma server, or just switch to a different tab, then the karma server is severely starved of CPU and the tests take a long time to complete.

The solution is to keep the karma tab active. The browser window can be hidden behind other windows but the karma tab must be the selected tab and the browser must not be minimised.

Following these simple rules will ensure that your tests always run at full speed.