use node-glob instead of wildcard for better pattern support #267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 alltest-*.js
files in all subdirectories oftest/
recursively (not just direct children oftest/
). 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.