Skip to content

Commit 1e2abc8

Browse files
authored
Merge pull request #10674 from Microsoft/glob_outdir_bug
#10585 Do not exclude outDir if exclude is given
2 parents c16ae3e + 68f0f67 commit 1e2abc8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/compiler/commandLineParser.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -858,14 +858,13 @@ namespace ts {
858858
errors.push(createCompilerDiagnostic(Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
859859
}
860860
else {
861-
// By default, exclude common package folders
861+
// By default, exclude common package folders and the outDir
862862
excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
863-
}
864863

865-
// Always exclude the output directory unless explicitly included
866-
const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
867-
if (outDir) {
868-
excludeSpecs.push(outDir);
864+
const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
865+
if (outDir) {
866+
excludeSpecs.push(outDir);
867+
}
869868
}
870869

871870
if (fileNames === undefined && includeSpecs === undefined) {

src/harness/unittests/tsconfigParsing.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace ts {
151151
);
152152
});
153153

154-
it("always exclude outDir", () => {
154+
it("exclude outDir unless overridden", () => {
155155
const tsconfigWithoutExclude =
156156
`{
157157
"compilerOptions": {
@@ -169,7 +169,7 @@ namespace ts {
169169
const allFiles = ["/bin/a.ts", "/b.ts"];
170170
const expectedFiles = ["/b.ts"];
171171
assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
172-
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
172+
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, allFiles);
173173
});
174174

175175
it("implicitly exclude common package folders", () => {

0 commit comments

Comments
 (0)