Skip to content
Open
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
4 changes: 2 additions & 2 deletions lib/globule.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function processPatterns(patterns, options, fn) {
}
// The first character is ! (exclusion). Remove any filepaths from the
// result set that match this pattern, sans leading !.
var filterFn = minimatch.filter(pattern.slice(1), options);
var filterFn = minimatch.filter(path.resolve(pattern.slice(1)), options);
result = _.filter(result, function(filepath) {
return !filterFn(filepath);
return !filterFn(path.resolve(filepath));
});
});
return result;
Expand Down
7 changes: 7 additions & 0 deletions test/globule_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ exports['find'] = {
'inclusion / exclusion order matters');
test.done();
},
'exclusion against relative paths': function (test) {
test.expect(1);
test.deepEqual(globule.find('../../fixtures/expand/js/*.js', 'css/**/*.css', '!**/js/**', '!**/css/**/qux.css'), [
'css/baz.css'],
'exclusion rules should be properly evaluated against relative filepaths');
test.done();
},
'options.src': function(test) {
test.expect(4);
test.deepEqual(globule.find({src: '**/*.js'}), ['js/bar.js', 'js/foo.js'], 'single pattern argument should match.');
Expand Down