karma-runner/karma — pull request #604 by vojtajina (2013-06-27 00:24:25+00:00)
Title: Changing the config syntax again ;-)

Guy, I know you gonna hate me, but I was fiddling with the config file during migrating whole AngularJS test suite to latest karma@canary and realized I'm not happy with the config syntax.

So I'm proposing another little change, here's an example:
````javascript
// before:
module.exports = function(karma) {
karma.configure({port: 123});
karma.defineLauncher('x', 'Chrome', {
flags: ['--disable-web-security']
});
karma.definePreprocessor('y', 'coffee', {
bare: false
});
karma.defineReporter('z', 'coverage', {
type: 'html'
});
};

// after:
module.exports = function(config) {
config.set({
port: 123,
definedLaunchers: {
'x': {
base: 'Chrome',
flags: ['--disable-web-security']
}
},
definedPreprocessors: {
'y': {
base: 'coffee',
bare: false
}
},
definedReporters: {
'z': {
base: 'coverage',
type: 'html'
}
}
});
};
````

**The reasons for this change:**
1/ easier to override config properties
The config object was not exposed and karma.configure() only does shallow merge.
Now, this is possible, eg. config.sauceLabs.testName = 'overridden';
This is helpful especially when using multiple config files (eg. a shared config between multiple projects or having a per developer config file that overrides project defaults).

2/ declarative definition of custom launchers/preprocessors/reporters makes more consistent and therefore easier to explain.

3/ declarative definition of custom launchers/preprocessors/reporters also makes it possible to use these with grunt-karma or from JSON config file.

The change is done in a backwards compatible manner, if one use old APIs such as karma.configure() or karma.defineLauncher(), it works. Only warning is displayed. These extra APIs will be removed in v0.11.0.

**Please, let me know, what you think.** I was about to push the current canary into stable, but I think we should do this before, so that people using stable version only have to migrate their configs one.

CC @Dignifiedquire, @bitwiseman, @gfxmonk, @iammerrick