mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge pull request #8703 from zhengbli/excludeOutDir
exclude outDir and add more default excludes
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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"]
|
||||
)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user