allow coverage instrumentation of multiple files#125
Conversation
|
Hi @bjouhier! Instead of overloading the lib/coverage.js options = {
dir: 'coverage',
reporters: ['lcov', 'json'],
files: null
};Not quite as clean, but then the matcher = function(file) {
if (options.coverage.files) {
if (typeof options.coverage.files === 'string') return file.indexOf(options.coverage) === 0;
else if (options.coverage.files instanceof RegExp) return options.coverage.test(file);
}
return file === options.code.path;
}An even better solution might utilize pattern globbing, but perhaps as a future enhancement. |
There was a problem hiding this comment.
I think instead of string, we should use an array here, otherwise its fine ...
|
@fyockm Hi Drew!!! That's a good point. I've followed your suggestion to use |
|
merged |
|
Thanks @kof |
allow coverage instrumentation of multiple files
|
thats true, do we really need regexp there? |
|
Can you add some tests? |
|
I can manage without regexps. Looked like a cool and easy-to-implement feature but it's only cool. I'll remove regexps and add tests but I'll do it a bit later. |
|
👍 |
This PR is a quick hack to enable code coverage on multiple files. It allows you to set the coverage option to:
codeoption will be included in the coverage report.