From 7d2ce0f5c19273c315eed634eb1705fc5fe09947 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 11 Feb 2016 09:48:47 -0800 Subject: [PATCH] fix falling tests and linter issues (cherry picked from commit 7404b901b962d0673b7d4522cd961c3dd8859e9b) --- src/compiler/commandLineParser.ts | 8 ++++---- tests/cases/unittests/cachingInServerLSHost.ts | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ab42aa96bcd..86d073f7d49 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -554,14 +554,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/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts index 59f97f434e6..2b6e24e5770 100644 --- a/tests/cases/unittests/cachingInServerLSHost.ts +++ b/tests/cases/unittests/cachingInServerLSHost.ts @@ -7,10 +7,16 @@ module ts { } function createDefaultServerHost(fileMap: Map): server.ServerHost { - const directories: Map = {}; - for (const f in fileMap) { - directories[getDirectoryPath(f)] = f; - } + 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", @@ -30,7 +36,7 @@ module ts { return hasProperty(fileMap, path); }, directoryExists: (path: string): boolean => { - return hasProperty(directories, path); + return hasProperty(existingDirectories, path); }, createDirectory: (path: string) => { },