Honor the --exclude option on a list of files (#387)

This commit is contained in:
Dennis Ploeger
2017-02-13 19:46:46 +01:00
committed by Blake Embrey
parent e748236080
commit 6ddb7f5976
2 changed files with 18 additions and 1 deletions

View File

@@ -272,7 +272,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
file = Path.resolve(file);
if (FS.statSync(file).isDirectory()) {
add(file);
} else {
} else if (exclude && !exclude.match(file)) {
files.push(file);
}
});

View File

@@ -16,5 +16,22 @@ describe('TypeDoc', function() {
Assert.notEqual(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
Assert.equal(expanded.indexOf(inputFiles), -1);
});
it('honors the exclude argument even on a fixed file list', function() {
var inputFiles = Path.join(__dirname, 'converter', 'class');
application.options.setValue('exclude', '**/class.ts');
var expanded = application.expandInputFiles([inputFiles]);
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
Assert.equal(expanded.indexOf(inputFiles), -1);
});
it('supports multiple excludes', function() {
var inputFiles = Path.join(__dirname, 'converter');
application.options.setValue('exclude', '**/+(class|access).ts');
var expanded = application.expandInputFiles([inputFiles]);
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'class', 'class.ts')), -1);
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'access', 'access.ts')), -1);
Assert.equal(expanded.indexOf(inputFiles), -1);
});
});
});