Honor the --exclude option on a list of files (#387)
				
					
				
			This commit is contained in:
		
				
					committed by
					
						
						Blake Embrey
					
				
			
			
				
	
			
			
			
						parent
						
							e748236080
						
					
				
				
					commit
					6ddb7f5976
				
			@@ -272,7 +272,7 @@ export class Application extends ChildableComponent<Application, AbstractCompone
 | 
				
			|||||||
            file = Path.resolve(file);
 | 
					            file = Path.resolve(file);
 | 
				
			||||||
            if (FS.statSync(file).isDirectory()) {
 | 
					            if (FS.statSync(file).isDirectory()) {
 | 
				
			||||||
                add(file);
 | 
					                add(file);
 | 
				
			||||||
            } else {
 | 
					            } else if (exclude && !exclude.match(file)) {
 | 
				
			||||||
                files.push(file);
 | 
					                files.push(file);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,5 +16,22 @@ describe('TypeDoc', function() {
 | 
				
			|||||||
            Assert.notEqual(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
 | 
					            Assert.notEqual(expanded.indexOf(Path.join(inputFiles, 'class.ts')), -1);
 | 
				
			||||||
            Assert.equal(expanded.indexOf(inputFiles), -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);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user