Skip to content

Commit 6ddb7f5

Browse files
Dennis Ploegerblakeembrey
Dennis Ploeger
authored andcommitted
Honor the --exclude option on a list of files (#387)
1 parent e748236 commit 6ddb7f5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/lib/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
272272
file = Path.resolve(file);
273273
if (FS.statSync(file).isDirectory()) {
274274
add(file);
275-
} else {
275+
} else if (exclude && !exclude.match(file)) {
276276
files.push(file);
277277
}
278278
});

test/typedoc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,22 @@ describe('TypeDoc', function() {
1616
Assert.notEqual(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
1717
Assert.equal(expanded.indexOf(inputFiles), -1);
1818
});
19+
it('honors the exclude argument even on a fixed file list', function() {
20+
var inputFiles = Path.join(__dirname, 'converter', 'class');
21+
application.options.setValue('exclude', '**/class.ts');
22+
var expanded = application.expandInputFiles([inputFiles]);
23+
24+
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
25+
Assert.equal(expanded.indexOf(inputFiles), -1);
26+
});
27+
it('supports multiple excludes', function() {
28+
var inputFiles = Path.join(__dirname, 'converter');
29+
application.options.setValue('exclude', '**/+(class|access).ts');
30+
var expanded = application.expandInputFiles([inputFiles]);
31+
32+
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'class', 'class.ts')), -1);
33+
Assert.equal(expanded.indexOf(Path.join(inputFiles, 'access', 'access.ts')), -1);
34+
Assert.equal(expanded.indexOf(inputFiles), -1);
35+
});
1936
});
2037
});

0 commit comments

Comments
 (0)