Skip to content

Commit

Permalink
Merge pull request #31 from zaygraveyard/issue30
Browse files Browse the repository at this point in the history
Add support for passing options to `minimatch` using `minimatchOptions` option. (fixes #30)
  • Loading branch information
devongovett committed Feb 23, 2016
2 parents d4bb901 + 830f12a commit ab27c00
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions index.js
Expand Up @@ -4,14 +4,20 @@ var minimatch = require('minimatch');

var defaultIgnore = ['**/node_modules/**', '**/bower_components/**', '**/test/**', '**/tests/**', '**/*.json'];

function shouldIgnoreFile(file, options) {
var ignore = options.defaultIgnore === false ? [] : defaultIgnore;
ignore = ignore.concat(options.ignore || []);

return ignore.some(function(pattern) {
return minimatch(file, pattern, options.minimatchOptions);
});
}

module.exports = function(options, extraOptions) {
options = options || {};

function transform(file) {
var ignore = options.defaultIgnore === false ? [] : defaultIgnore;
ignore = ignore.concat(options.ignore || []);

if (ignore.some(minimatch.bind(null, file)))
if (shouldIgnoreFile(file, options))
return through();

var instrumenter = new (options.instrumenter || istanbul).Instrumenter(options.instrumenterConfig || {});
Expand Down

0 comments on commit ab27c00

Please sign in to comment.