diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a41038c5e4..779db74048 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -527,14 +527,14 @@ namespace ts { const filesSeen: Map = {}; let exclude: string[] = []; - if(json["exclude"] instanceof Array){ + if (json["exclude"] instanceof Array) { exclude = json["exclude"]; } else { // by default exclude node_modules, and any specificied output directory - exclude = ["node_modules"] - let outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; - if(outDir) { + exclude = ["node_modules"]; + const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { exclude.push(outDir); } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 75de3ed525..47b6d44ccb 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1288,7 +1288,6 @@ namespace ts { const languageVersion = options.target || ScriptTarget.ES3; const outFile = options.outFile || options.out; - const firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { const firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); if (firstNonExternalModuleSourceFile) { diff --git a/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts index 88b44a693b..2b6e24e577 100644 --- a/tests/cases/unittests/cachingInServerLSHost.ts +++ b/tests/cases/unittests/cachingInServerLSHost.ts @@ -7,6 +7,16 @@ module ts { } function createDefaultServerHost(fileMap: Map): server.ServerHost { + let existingDirectories: Map = {}; + forEachValue(fileMap, v => { + let dir = getDirectoryPath(v.name); + let previous: string; + do { + existingDirectories[dir] = true; + previous = dir; + dir = getDirectoryPath(dir); + } while (dir !== previous); + }); return { args: [], newLine: "\r\n", @@ -26,7 +36,7 @@ module ts { return hasProperty(fileMap, path); }, directoryExists: (path: string): boolean => { - throw new Error("NYI"); + return hasProperty(existingDirectories, path); }, createDirectory: (path: string) => { },