The good thing is that you don't have to migrate everything at once. You can keep the global Karma and update project by project.
Let's get started...
First upgrade your local or global install of Karma via the command line using NPM.
# upgrade local install...
cd <path-to-your-project>
npm install karma
# or upgrade global install...
sudo npm install -g karma
All the frameworks, reporters, preprocessors and browser launchers are now separate plugins. Here is a list of all of them including related plugins. So install all the plugins you need:
npm install karma-<plugin name> --save-dev
karma-jasmine
ships with Karma)karma-mocha
karma-qunit
karma-coffee-preprocessor
ships with Karma)karma-ng-html2js-preprocessor
ships with Karma)karma-coverage
karma-live-preprocessor
karma-growl-reporter
karma-junit-reporter
karma-teamcity-reporter
karma-chrome-launcher
ships with Karma)karma-chrome-launcher
ships with Karma)karma-phantomjs-launcher
ships with Karma)karma-firefox-launcher
karma-safari-launcher
karma-ie-launcher
karma-opera-launcher
The configuration file is now a regular Node module, that exports a single function. This function will get called with a config object:
module.exports = function(config) {
config.set({
basePath: '.',
files: [
// ...
]
})
};
Also, remove all the constants like JASMINE
, JASMINE_ADAPTER
, MOCHA
, MOCHA_ADAPTER
, QUNIT
, QUNIT_ADAPTER
, REQUIRE
, REQUIRE_ADAPTER
, ANGULAR_SCENARIO
, ANGULAR_SCENARIO_ADAPTER
from files and use frameworks config instead:
// before
files = [
JASMINE,
JASMINE_ADAPTER,
'*.js'
];
// change to
module.exports = function(config) {
config.set({
frameworks: ['jasmine'],
files: ['*.js']
});
};
That should be it ;-) If you have any problem, ask on mailing list.
You can also check out migrating AngularJS.