From c6d82484f6635abdb8eec6f90d7ff9194d5c45f0 Mon Sep 17 00:00:00 2001 From: Jeff McRiffey Date: Tue, 13 Dec 2016 19:36:31 -0500 Subject: [PATCH] use globby --- lib/command/common/run-with-cover.js | 4 +++- lib/command/instrument.js | 4 +++- lib/util/file-matcher.js | 5 ++--- package.json | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/command/common/run-with-cover.js b/lib/command/common/run-with-cover.js index a9982a4f..ccaa162a 100644 --- a/lib/command/common/run-with-cover.js +++ b/lib/command/common/run-with-cover.js @@ -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) { diff --git a/lib/command/instrument.js b/lib/command/instrument.js index 0948a487..120a5ffc 100644 --- a/lib/command/instrument.js +++ b/lib/command/instrument.js @@ -210,7 +210,9 @@ Command.mix(InstrumentCommand, { includes = ['**/*']; } else { - includes = iOpts.extensions(); + includes = iOpts.extensions().map(function(ext) { + return "**/*" + ext; + }); } instrumenter = new Instrumenter({ diff --git a/lib/util/file-matcher.js b/lib/util/file-matcher.js index 9cdd6033..45fb121b 100644 --- a/lib/util/file-matcher.js +++ b/lib/util/file-matcher.js @@ -4,7 +4,7 @@ */ var async = require('async'), - glob = require('glob'), + globby = require('globby'), fs = require('fs'), path = require('path'), seq = 0; @@ -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); } diff --git a/package.json b/package.json index eccd4e06..518850b8 100644 --- a/package.json +++ b/package.json @@ -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",