From 9c92ec3a55e37ca2bd4c5aa10f41d757a2521202 Mon Sep 17 00:00:00 2001 From: zhengbli Date: Thu, 19 May 2016 16:10:04 -0700 Subject: [PATCH 1/2] exclude outDir and add more default excludes --- src/compiler/commandLineParser.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d9f9b040ac6..a8d955d3b16 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -701,11 +701,11 @@ namespace ts { } else { // by default exclude node_modules, and any specificied output directory - exclude = ["node_modules"]; - const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; - if (outDir) { - exclude.push(outDir); - } + exclude = ["node_modules", "bower_components", "jspm_packages"]; + } + const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + exclude.push(outDir); } exclude = map(exclude, normalizeSlashes); From 6cc1ff102ee3f7ba183f1dd934cd173b93077697 Mon Sep 17 00:00:00 2001 From: zhengbli Date: Thu, 19 May 2016 17:26:12 -0700 Subject: [PATCH 2/2] add unit tests --- tests/cases/unittests/tsconfigParsing.ts | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/cases/unittests/tsconfigParsing.ts b/tests/cases/unittests/tsconfigParsing.ts index ec025e0b210..776d9495e87 100644 --- a/tests/cases/unittests/tsconfigParsing.ts +++ b/tests/cases/unittests/tsconfigParsing.ts @@ -170,5 +170,36 @@ namespace ts { ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"] ) }); + + it("always exclude outDir", () => { + const tsconfigWithoutExclude = + `{ + "compilerOptions": { + "outDir": "bin" + } + }`; + const tsconfigWithExclude = + `{ + "compilerOptions": { + "outDir": "bin" + }, + "exclude": [ "obj" ] + }`; + const rootDir = "/"; + const allFiles = ["/bin/a.ts", "/b.ts"]; + const expectedFiles = ["/b.ts"]; + assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles); + assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles); + }) + + it("implicitly exclude common package folders", () => { + assertParseFileList( + `{}`, + "tsconfig.json", + "/", + ["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"], + ["/d.ts", "/folder/e.ts"] + ) + }) }); }