Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swap fileset for glob, Fixes #638 #673

Merged
merged 1 commit into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ The following third-party libraries are used by this module:
* async: https://github.com/caolan/async - for parallel instrumentation of files
* escodegen: https://github.com/Constellation/escodegen - for JS code generation
* esprima: https://github.com/ariya/esprima - for JS parsing
* fileset: https://github.com/mklabs/node-fileset - for loading and matching path expressions
* glob: https://github.com/isaacs/node-glob - for loading and matching path expressions
* handlebars: https://github.com/wycats/handlebars.js/ - for report template expansion
* js-yaml: https://github.com/nodeca/js-yaml - for YAML config file load
* mkdirp: https://github.com/substack/node-mkdirp - to create output directories
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = {
* When no options are passed, the match function is one that matches all JS
* files under the current working directory except ones under `node_modules`
*
* Match patterns are `ant`-style patterns processed using the `fileset` library.
* Match patterns are `ant`-style patterns processed using the `glob` library.
* Examples not provided due to limitations in putting asterisks inside
* jsdoc comments. Please refer to tests under `test/other/test-matcher.js`
* for examples.
Expand Down
2 changes: 1 addition & 1 deletion lib/command/check-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Command.mix(CheckCoverageCommand, {
console.error('For example, --statements 90 implies minimum statement coverage is 90%.');
console.error(' --statements -10 implies that no more than 10 uncovered statements are allowed\n');
console.error('Per-file thresholds can be specified via a configuration file.\n');
console.error('<include-pattern> is a fileset pattern that can be used to select one or more coverage files ' +
console.error('<include-pattern> is a glob pattern that can be used to select one or more coverage files ' +
'for merge. This defaults to "**/coverage*.json"');

console.error('\n');
Expand Down
4 changes: 2 additions & 2 deletions lib/command/common/run-with-cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function usage(arg0, command) {
+ [
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
formatOption('--root <path> ', 'the root path to look for files to instrument, defaults to .'),
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns e.g. "**/vendor/**"'),
formatOption('-i <include-pattern> [-i <include-pattern>]', 'one or more fileset patterns e.g. "**/*.js"'),
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more glob patterns e.g. "**/vendor/**"'),
formatOption('-i <include-pattern> [-i <include-pattern>]', 'one or more glob patterns e.g. "**/*.js"'),
formatOption('--[no-]default-excludes', 'apply default excludes [ **/node_modules/**, **/test/**, **/tests/** ], defaults to true'),
formatOption('--hook-run-in-context', 'hook vm.runInThisContext in addition to require (supports RequireJS), defaults to false'),
formatOption('--post-require-hook <file> | <module>', 'JS module that exports a function for post-require processing'),
Expand Down
2 changes: 1 addition & 1 deletion lib/command/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Command.mix(InstrumentCommand, {
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
formatOption('--output <file-or-dir>', 'The output file or directory. This is required when the input is a directory, ' +
'defaults to standard output when input is a file'),
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns (e.g. "**/vendor/**" to ignore all files ' +
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more glob patterns (e.g. "**/vendor/**" to ignore all files ' +
'under a vendor directory). Also see the --default-excludes option'),
formatOption('--variable <global-coverage-variable-name>', 'change the variable name of the global coverage variable from the ' +
'default value of `__coverage__` to something else'),
Expand Down
2 changes: 1 addition & 1 deletion lib/command/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Command.mix(ReportCommand, {
formatOption('--config <path-to-config>', 'the configuration file to use, defaults to .istanbul.yml'),
formatOption('--root <input-directory>', 'The input root directory for finding coverage files'),
formatOption('--dir <report-directory>', 'The output directory where files will be written. This defaults to ./coverage/'),
formatOption('--include <glob>', 'The fileset pattern to select one or more coverage files, defaults to **/coverage*.json'),
formatOption('--include <glob>', 'The glob pattern to select one or more coverage files, defaults to **/coverage*.json'),
formatOption('--verbose, -v', 'verbose mode')
].join('\n\n'));

Expand Down
4 changes: 2 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ addMethods(InstrumentOptions,
*/
InstrumentOptions.prototype.root = function () { return path.resolve(this.config.root); };
/**
* returns an array of fileset patterns that should be excluded for instrumentation.
* returns an array of glob patterns that should be excluded for instrumentation.
* Used by the `instrument` and `cover` commands.
* @method excludes
* @return {Array} an array of fileset patterns that should be excluded for
* @return {Array} an array of glob patterns that should be excluded for
* instrumentation.
*/
InstrumentOptions.prototype.excludes = function (excludeTests) {
Expand Down
6 changes: 3 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'),
fileset = require('fileset'),
glob = require('glob'),
fs = require('fs'),
path = require('path'),
seq = 0;
Expand All @@ -27,10 +27,10 @@ function filesFor(options, callback) {
includes = includes && Array.isArray(includes) ? includes : [ '**/*.js' ];
excludes = excludes && Array.isArray(excludes) ? excludes : [ '**/node_modules/**' ];

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

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"async": "1.x",
"escodegen": "1.8.x",
"esprima": "2.7.x",
"fileset": "0.2.x",
"glob": "^5.0.15",
"handlebars": "^4.0.1",
"js-yaml": "3.x",
"mkdirp": "0.5.x",
Expand All @@ -124,7 +124,6 @@
},
"devDependencies": {
"coveralls": "2.x",
"glob": "^5.0.14",
"jshint": "^2.8.0",
"nodeunit": "0.9.x",
"requirejs": "2.x",
Expand Down
4 changes: 2 additions & 2 deletions test/other/test-matcher.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*jslint nomen: true */
var path = require('path'),
fileset = require('fileset'),
glob = require('glob'),
root = path.resolve(__dirname, 'data', 'matcher'),
src = '../../lib/util/file-matcher.js',
fileMatcher = require(src),
Expand All @@ -9,7 +9,7 @@ var path = require('path'),
module.exports = {
setUp: function (cb) {
if (!allFiles) {
fileset('**/*.js', '', { cwd: root}, function (err, files) {
glob('**/*.js', { cwd: root}, function (err, files) {
allFiles = files.map(function (file) { return path.resolve(root, file); });
cb();
});
Expand Down