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

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

Merged
merged 1 commit into from
Apr 3, 2013

Conversation

coltrane
Copy link

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.

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'`.
@adamstallard
Copy link

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

@JerrySievert
Copy link

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

@indexzero
Copy link

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

indexzero added a commit that referenced this pull request Apr 3, 2013
use node-glob instead of wildcard for better pattern support
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants