Skip to content

Commit

Permalink
Honor the --exclude option on a list of files (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
dploeger authored and blakeembrey committed Feb 13, 2017
1 parent e748236 commit 6ddb7f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

This comment has been minimized.

Copy link
@aciccarello

aciccarello Feb 15, 2017

Collaborator

Maybe this should have been

} else if (!exclude || !exclude.match(file)) {

This comment has been minimized.

Copy link
@steveschmitt

steveschmitt Feb 15, 2017

I think you're right. Also need to update the tests to catch this sort of bug.

files.push(file);
}
});
Expand Down
17 changes: 17 additions & 0 deletions test/typedoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});

1 comment on commit 6ddb7f5

@steveschmitt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit seems to cause all files to be excluded when --exclude is omitted. I'm not getting any output generated unless I put a dummy --exclude xx in the command line.

Please sign in to comment.