karma-runner/grunt-karma — pull request #122 by jpommerening (2014-08-22 10:08:58+00:00)
Title: Use Grunt's file resolution

`grunt-karma` should leave the file globbing to Grunt _and_ it should support Karma's file [options](http://karma-runner.github.io/0.12/config/files.html) for watching files, including them, etc..

The former was first suggested in #60, but did not make it into `master`. The latter, well there is #51, but tl;dr and _oh god, it's full of diffs_ :sparkles:.

I implemented this by appending the files that are specified "[the Grunt way](http://gruntjs.com/configuring-tasks#files)" (`this.files[0..n].src`) to the files specified via `options.files`.

For each object `{src: [...]}` in `this.files[0..n]` the code generates an array containing file objects, that may optionally have `included`, `watched` and/or `served` set and finally concats/flattens them to `options.files` ([here](#diff-a6d84f8e02b7bd2abf8354f465508f43R58)):
```js
options: {
files: ['index.js']
},
target: {
files: [
{ src: 'test/**/*.js' },
{ src: 'lib/**/*.js', included: false }
]
}
/* becomes */
files = [
'index.js',
{ pattern: 'test/file1.js' },
{ pattern: 'test/file2.js' },
// ...
{ pattern: 'lib/file1.js', included: false },
{ pattern: 'lib/file2.js', included: false },
// ...
];
```