Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Passing regex-matcher as exclude option does not work #22

Closed
mweibel opened this issue Apr 17, 2013 · 1 comment
Closed

Passing regex-matcher as exclude option does not work #22

mweibel opened this issue Apr 17, 2013 · 1 comment

Comments

@mweibel
Copy link

mweibel commented Apr 17, 2013

When specifying e.g. --exclude /*.hbs/ to exclude handlebars files, it will be passed as a string and not as an object which would be required by the following code:

// index.js
    nodes.forEach(function (v) {
      // ignore filter
      var m;
      for (var n = 0 ; n < ignoreLen; n++) {
        m = _exclude[n];
        if (typeof m === 'string' && m === v) {
          return;
        } else if (typeof m === 'object' && m.test(v)) {
          return;
        }
      }
      // process file
      tmpPath = path.join(source, v);
      tmpDest = path.join(dest, v);
      self.processFile(tmpPath, tmpDest, exclude, option);
    });
  }

I temporarily fixed this by patching the jscoverage bin file:

// bin/jscoverage, Line 25
for(var i = 0, l = exclude.length; i < l; i++) {
  var currentExclude = exclude[i];
  if (currentExclude[0] === '/') {
    var lastSlash = currentExclude.lastIndexOf('/');
    var matchPattern = currentExclude.substr(1, lastSlash -1);
    exclude[i] = new RegExp(matchPattern);
  }
}

But didn't figure out yet where to put this within the original source to make a pull request ;)

@mweibel mweibel closed this as completed Apr 17, 2013
@mweibel
Copy link
Author

mweibel commented Apr 17, 2013

It seems that I've been trapped by the wrong module published on npm.. :|

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant