use node-glob instead of wildcard for better pattern support #267

Merged
merged 1 commit into from Apr 3, 2013

Conversation

Projects
None yet
4 participants
Contributor

coltrane commented Feb 25, 2013

node-glob "is a glob implementation in JavaScript. It uses the minimatch library to do its matching."

https://github.com/isaacs/node-glob
https://github.com/isaacs/minimatch

This commit replaces "wildcard.js" with the equivalent (but more standardized, and full-featured) functionality from node-glob. This allows vows to be called, for example, like this:
vows --spec 'test/**/test-*.js'

Unlike the original wildcard functionality, the ** in the above pattern will now match all test-*.js files in all subdirectories of test/ recursively (not just direct children of test/). Numerous other nice features are supported as well -- see node-glob, and minimatch for details.

Note 1: this has not been tested on windows. Node-glob is reported to work on windows, but does include some caveats with regards to use of \ as a path separator. If this proves to be an issue, it could probably be addressed by simply replacing all backslashes with forward-slashes before calling glob.

Note 2: if anyone is relying specifically on the old non-recursive behavior of **, then this change will break them (though the fix would be trivial). Also, the glob package is sensitive to a number of other special chars that "wildcard.js" was not sensitive to. (see minimatch for specifics). Any special char can be escaped with a \ to preserve its literal value.

@coltrane coltrane use node-glob instead of wildcard for better pattern support
node-glob is located here: <https://github.com/isaacs/node-glob>
It supports common filename glob patterns, including patterns
like: `'**/*.js'`.  This commit allows vows to be called, for
example, like this: `vows --spec '**/test-*.js'`.
8e4c8b8
Contributor

adamstallard commented Mar 1, 2013

grunt-vows-runner uses node-glob to match files via grunt. You can also use templates to match files (also via grunt).

Contributor

JerrySievert commented Apr 3, 2013

anyone have any objections to pulling this in? it would also answer #269

Owner

indexzero commented Apr 3, 2013

I am fine with this. Using modules is better anyway.

@indexzero indexzero added a commit that referenced this pull request Apr 3, 2013

@indexzero indexzero Merge pull request #267 from coltrane/glob
use node-glob instead of wildcard for better pattern support
fb0ec87

@indexzero indexzero merged commit fb0ec87 into vowsjs:master Apr 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment