We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f6981b3 + b53a7ee commit b0d6832Copy full SHA for b0d6832
1 file changed
lib/coverage.js
@@ -54,7 +54,17 @@ exports.instrument = function(options) {
54
var matcher, instrumenter;
55
56
matcher = function (file) {
57
- return file === options.code.path;
+ var files = options.coverage.files;
58
+ if (files) {
59
+ files = Array.isArray(files) ? files : [files];
60
+ return files.some(function(f) {
61
+ if (typeof f === 'string') return file.indexOf(f) === 0;
62
+ else if (f instanceof RegExp) return f.test(file);
63
+ else throw new Error("invalid entry in options.coverage.files: " + typeof f);
64
+ });
65
+ } else {
66
+ return file === options.code.path;
67
+ }
68
}
69
instrumenter = new istanbul.Instrumenter();
70
istanbul.hook.hookRequire(matcher, instrumenter.instrumentSync.bind(instrumenter));
0 commit comments