mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge pull request #617 from cdparks/fix-excludes
Fix for #616, making excluded-filepaths play nicely with -r
This commit is contained in:
commit
b7782fc151
@ -57,7 +57,7 @@ exports.Filter.prototype.isIncluded = function(filepath) {
|
||||
|
||||
if (this.exclude) {
|
||||
this.exclude.forEach(function(exclude) {
|
||||
if ( exclude === filepath || exclude === path.dirname(filepath) ) {
|
||||
if ( filepath.indexOf(exclude) === 0 ) {
|
||||
included = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -137,6 +137,30 @@ describe('jsdoc/src/filter', function() {
|
||||
expect( files.indexOf('yes.js') ).toBeGreaterThan(-1);
|
||||
expect( files.indexOf('module/yes.js') ).toBeGreaterThan(-1);
|
||||
});
|
||||
|
||||
it('should be able to exclude descendants of excluded subdirectories', function() {
|
||||
var files = [
|
||||
'yes.js',
|
||||
'topsecret/nested/nope.js',
|
||||
'module/yes.js',
|
||||
'module/topsecret/nested/nope.js'
|
||||
];
|
||||
myFilter = new filter.Filter({
|
||||
includePattern: defaultIncludePattern,
|
||||
excludePattern: defaultExcludePattern,
|
||||
exclude: ['topsecret', 'module/topsecret']
|
||||
});
|
||||
|
||||
files = files.filter(function($) {
|
||||
return myFilter.isIncluded($);
|
||||
});
|
||||
|
||||
expect(files.length).toBe(2);
|
||||
expect( files.indexOf('yes.js') ).toBeGreaterThan(-1);
|
||||
expect( files.indexOf('module/yes.js') ).toBeGreaterThan(-1);
|
||||
expect( files.indexOf('topsecret/nested/nope.js') ).toBe(-1);
|
||||
expect( files.indexOf('module/topsecret/nested/nope.js') ).toBe(-1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user