karma-runner/karma-commonjs — pull request #3 by afbobak (2013-08-31 09:16:42+00:00)
Title: Add ability to map source paths to module names.

Using browserify with express allows me to require npm modules directly from the node_modules path, e.g. require("bean"). karma-commonjs unfortunately resolves "bean" to a relative path to the source file which of course doesn't work, as that would be something like "../../node_modules/bean/bean".

This patch adds a "commonjs" config with one property "map" that allows to map any source file to a different module name. Example karma.conf.js snippet:
```
[...]
files : [
{pattern: 'node_modules/bean/bean.js', watched: false},
{pattern: 'node_modules/domready/ready.js', watched: false},
'browser/lib/*.js',
'browser/lib/**/*.js',
'browser/test/*-test.js',
'browser/test/**/*-test.js'
],
preprocessors : {
'node_modules/bean/bean.js' : ['commonjs'],
'node_modules/domready/ready.js' : ['commonjs'],
'browser/**/*.js' : ['commonjs']
},
commonjs : {
map : {
'node_modules/bean/bean.js' : 'bean',
'node_modules/domready/ready.js' : 'domready'
}
},
[...]
```