Skip to content

Commit

Permalink
use globby
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrifwald committed Dec 14, 2016
1 parent 6710c76 commit c6d8248
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/command/common/run-with-cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ function run(args, commandName, enableHooks, callback) {
excludes.push(path.relative(process.cwd(), path.join(reportingDir, '**', '*')));
matcherFor({
root: config.instrumentation.root() || process.cwd(),
includes: opts.i || config.instrumentation.extensions(),
includes: opts.i || config.instrumentation.extensions().map(function(ext) {
return "**/*" + ext;
}),
excludes: excludes
},
function (err, matchFn) {
Expand Down
4 changes: 3 additions & 1 deletion lib/command/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ Command.mix(InstrumentCommand, {
includes = ['**/*'];
}
else {
includes = iOpts.extensions();
includes = iOpts.extensions().map(function(ext) {
return "**/*" + ext;
});
}

instrumenter = new Instrumenter({
Expand Down
5 changes: 2 additions & 3 deletions lib/util/file-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

var async = require('async'),
glob = require('glob'),
globby = require('globby'),
fs = require('fs'),
path = require('path'),
seq = 0;
Expand All @@ -26,12 +26,11 @@ function filesFor(options, callback) {
root = root || process.cwd();
includes = includes && Array.isArray(includes) ? includes : [ '**/*.js' ];
excludes = excludes && Array.isArray(excludes) ? excludes : [ '**/node_modules/**' ];
includes = includes.length > 1 ? "**/*@(" + includes.join('|') + ")" : includes[0];

opts = { cwd: root, nodir: true, ignore: excludes };
seq += 1;
opts['x' + seq + new Date().getTime()] = true; //cache buster for minimatch cache bug
glob(includes, opts, function (err, files) {
globby(includes, opts, function (err, files) {
if (err) { return callback(err); }
if (relative) { return callback(err, files); }

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"escodegen": "1.8.x",
"esprima": "2.7.x",
"glob": "^5.0.15",
"globby": "^6.1.0",
"handlebars": "^4.0.1",
"js-yaml": "3.x",
"mkdirp": "0.5.x",
Expand Down

0 comments on commit c6d8248

Please sign in to comment.