Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeDoc now also honors the --exclude option on a list of files #387

Merged
merged 2 commits into from
Feb 13, 2017
Merged
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
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)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wanted to note that #395 suggested there was a problem here. Thanks for the fix!

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);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add a few more test cases? There are quite a few GitHub issues regarding exclude so better testing will help us sort out what problems actually exist. For example, could you add a test with multiple excludes (see #170 comment)?

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);
});
});
});