Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Commit da79378

Browse files
authored
Merge pull request #673 from popomore/swap-fileset-for-glob
swap fileset for glob, Fixes #638
2 parents fef889b + 58f4c90 commit da79378

File tree

10 files changed

+15
-16
lines changed

10 files changed

+15
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ The following third-party libraries are used by this module:
259259
* async: https://github.com/caolan/async - for parallel instrumentation of files
260260
* escodegen: https://github.com/Constellation/escodegen - for JS code generation
261261
* esprima: https://github.com/ariya/esprima - for JS parsing
262-
* fileset: https://github.com/mklabs/node-fileset - for loading and matching path expressions
262+
* glob: https://github.com/isaacs/node-glob - for loading and matching path expressions
263263
* handlebars: https://github.com/wycats/handlebars.js/ - for report template expansion
264264
* js-yaml: https://github.com/nodeca/js-yaml - for YAML config file load
265265
* mkdirp: https://github.com/substack/node-mkdirp - to create output directories

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = {
9393
* When no options are passed, the match function is one that matches all JS
9494
* files under the current working directory except ones under `node_modules`
9595
*
96-
* Match patterns are `ant`-style patterns processed using the `fileset` library.
96+
* Match patterns are `ant`-style patterns processed using the `glob` library.
9797
* Examples not provided due to limitations in putting asterisks inside
9898
* jsdoc comments. Please refer to tests under `test/other/test-matcher.js`
9999
* for examples.

lib/command/check-coverage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Command.mix(CheckCoverageCommand, {
7272
console.error('For example, --statements 90 implies minimum statement coverage is 90%.');
7373
console.error(' --statements -10 implies that no more than 10 uncovered statements are allowed\n');
7474
console.error('Per-file thresholds can be specified via a configuration file.\n');
75-
console.error('<include-pattern> is a fileset pattern that can be used to select one or more coverage files ' +
75+
console.error('<include-pattern> is a glob pattern that can be used to select one or more coverage files ' +
7676
'for merge. This defaults to "**/coverage*.json"');
7777

7878
console.error('\n');

lib/command/common/run-with-cover.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ function usage(arg0, command) {
2525
+ [
2626
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
2727
formatOption('--root <path> ', 'the root path to look for files to instrument, defaults to .'),
28-
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns e.g. "**/vendor/**"'),
29-
formatOption('-i <include-pattern> [-i <include-pattern>]', 'one or more fileset patterns e.g. "**/*.js"'),
28+
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more glob patterns e.g. "**/vendor/**"'),
29+
formatOption('-i <include-pattern> [-i <include-pattern>]', 'one or more glob patterns e.g. "**/*.js"'),
3030
formatOption('--[no-]default-excludes', 'apply default excludes [ **/node_modules/**, **/test/**, **/tests/** ], defaults to true'),
3131
formatOption('--hook-run-in-context', 'hook vm.runInThisContext in addition to require (supports RequireJS), defaults to false'),
3232
formatOption('--post-require-hook <file> | <module>', 'JS module that exports a function for post-require processing'),

lib/command/instrument.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Command.mix(InstrumentCommand, {
143143
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
144144
formatOption('--output <file-or-dir>', 'The output file or directory. This is required when the input is a directory, ' +
145145
'defaults to standard output when input is a file'),
146-
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns (e.g. "**/vendor/**" to ignore all files ' +
146+
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more glob patterns (e.g. "**/vendor/**" to ignore all files ' +
147147
'under a vendor directory). Also see the --default-excludes option'),
148148
formatOption('--variable <global-coverage-variable-name>', 'change the variable name of the global coverage variable from the ' +
149149
'default value of `__coverage__` to something else'),

lib/command/report.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Command.mix(ReportCommand, {
4343
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
4444
formatOption('--root <input-directory>', 'The input root directory for finding coverage files'),
4545
formatOption('--dir <report-directory>', 'The output directory where files will be written. This defaults to ./coverage/'),
46-
formatOption('--include <glob>', 'The fileset pattern to select one or more coverage files, defaults to **/coverage*.json'),
46+
formatOption('--include <glob>', 'The glob pattern to select one or more coverage files, defaults to **/coverage*.json'),
4747
formatOption('--verbose, -v', 'verbose mode')
4848
].join('\n\n'));
4949

lib/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ addMethods(InstrumentOptions,
203203
*/
204204
InstrumentOptions.prototype.root = function () { return path.resolve(this.config.root); };
205205
/**
206-
* returns an array of fileset patterns that should be excluded for instrumentation.
206+
* returns an array of glob patterns that should be excluded for instrumentation.
207207
* Used by the `instrument` and `cover` commands.
208208
* @method excludes
209-
* @return {Array} an array of fileset patterns that should be excluded for
209+
* @return {Array} an array of glob patterns that should be excluded for
210210
* instrumentation.
211211
*/
212212
InstrumentOptions.prototype.excludes = function (excludeTests) {

lib/util/file-matcher.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
var async = require('async'),
7-
fileset = require('fileset'),
7+
glob = require('glob'),
88
fs = require('fs'),
99
path = require('path'),
1010
seq = 0;
@@ -27,10 +27,10 @@ function filesFor(options, callback) {
2727
includes = includes && Array.isArray(includes) ? includes : [ '**/*.js' ];
2828
excludes = excludes && Array.isArray(excludes) ? excludes : [ '**/node_modules/**' ];
2929

30-
opts = { cwd: root, nodir: true };
30+
opts = { cwd: root, nodir: true, ignore: excludes };
3131
seq += 1;
3232
opts['x' + seq + new Date().getTime()] = true; //cache buster for minimatch cache bug
33-
fileset(includes.join(' '), excludes.join(' '), opts, function (err, files) {
33+
glob(includes.join(' '), opts, function (err, files) {
3434
if (err) { return callback(err); }
3535
if (relative) { return callback(err, files); }
3636

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"async": "1.x",
112112
"escodegen": "1.8.x",
113113
"esprima": "2.7.x",
114-
"fileset": "0.2.x",
114+
"glob": "^5.0.15",
115115
"handlebars": "^4.0.1",
116116
"js-yaml": "3.x",
117117
"mkdirp": "0.5.x",
@@ -124,7 +124,6 @@
124124
},
125125
"devDependencies": {
126126
"coveralls": "2.x",
127-
"glob": "^5.0.14",
128127
"jshint": "^2.8.0",
129128
"nodeunit": "0.9.x",
130129
"requirejs": "2.x",

test/other/test-matcher.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*jslint nomen: true */
22
var path = require('path'),
3-
fileset = require('fileset'),
3+
glob = require('glob'),
44
root = path.resolve(__dirname, 'data', 'matcher'),
55
src = '../../lib/util/file-matcher.js',
66
fileMatcher = require(src),
@@ -9,7 +9,7 @@ var path = require('path'),
99
module.exports = {
1010
setUp: function (cb) {
1111
if (!allFiles) {
12-
fileset('**/*.js', '', { cwd: root}, function (err, files) {
12+
glob('**/*.js', { cwd: root}, function (err, files) {
1313
allFiles = files.map(function (file) { return path.resolve(root, file); });
1414
cb();
1515
});

0 commit comments

Comments
 (0)