Skip to content

Commit 60c869f

Browse files
committed
allow coverage instrumentation of multiple files
1 parent f6981b3 commit 60c869f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/coverage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ exports.instrument = function(options) {
5454
var matcher, instrumenter;
5555

5656
matcher = function (file) {
57-
return file === options.code.path;
57+
if (typeof options.coverage === 'string') return file.indexOf(options.coverage) === 0;
58+
else if (options.coverage instanceof RegExp) return options.coverage.test(file);
59+
else return file === options.code.path;
5860
}
5961
instrumenter = new istanbul.Instrumenter();
6062
istanbul.hook.hookRequire(matcher, instrumenter.instrumentSync.bind(instrumenter));

0 commit comments

Comments
 (0)