diff --git a/lib/lib.scriptHost.d.ts b/lib/lib.scriptHost.d.ts
deleted file mode 100644
index d4c6131fd93..00000000000
--- a/lib/lib.scriptHost.d.ts
+++ /dev/null
@@ -1,294 +0,0 @@
-/*! *****************************************************************************
-Copyright (c) Microsoft Corporation. All rights reserved.
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0
-
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
-MERCHANTABLITY OR NON-INFRINGEMENT.
-
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */
-
-///
-
-
-/////////////////////////////
-/// Windows Script Host APIS
-/////////////////////////////
-
-
-interface ActiveXObject {
- new (s: string): any;
-}
-declare var ActiveXObject: ActiveXObject;
-
-interface ITextWriter {
- Write(s: string): void;
- WriteLine(s: string): void;
- Close(): void;
-}
-
-interface TextStreamBase {
- /**
- * The column number of the current character position in an input stream.
- */
- Column: number;
-
- /**
- * The current line number in an input stream.
- */
- Line: number;
-
- /**
- * Closes a text stream.
- * It is not necessary to close standard streams; they close automatically when the process ends. If
- * you close a standard stream, be aware that any other pointers to that standard stream become invalid.
- */
- Close(): void;
-}
-
-interface TextStreamWriter extends TextStreamBase {
- /**
- * Sends a string to an output stream.
- */
- Write(s: string): void;
-
- /**
- * Sends a specified number of blank lines (newline characters) to an output stream.
- */
- WriteBlankLines(intLines: number): void;
-
- /**
- * Sends a string followed by a newline character to an output stream.
- */
- WriteLine(s: string): void;
-}
-
-interface TextStreamReader extends TextStreamBase {
- /**
- * Returns a specified number of characters from an input stream, starting at the current pointer position.
- * Does not return until the ENTER key is pressed.
- * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
- */
- Read(characters: number): string;
-
- /**
- * Returns all characters from an input stream.
- * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
- */
- ReadAll(): string;
-
- /**
- * Returns an entire line from an input stream.
- * Although this method extracts the newline character, it does not add it to the returned string.
- * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
- */
- ReadLine(): string;
-
- /**
- * Skips a specified number of characters when reading from an input text stream.
- * Can only be used on a stream in reading mode; causes an error in writing or appending mode.
- * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
- */
- Skip(characters: number): void;
-
- /**
- * Skips the next line when reading from an input text stream.
- * Can only be used on a stream in reading mode, not writing or appending mode.
- */
- SkipLine(): void;
-
- /**
- * Indicates whether the stream pointer position is at the end of a line.
- */
- AtEndOfLine: boolean;
-
- /**
- * Indicates whether the stream pointer position is at the end of a stream.
- */
- AtEndOfStream: boolean;
-}
-
-declare var WScript: {
- /**
- * Outputs text to either a message box (under WScript.exe) or the command console window followed by
- * a newline (under CScript.exe).
- */
- Echo(s: any): void;
-
- /**
- * Exposes the write-only error output stream for the current script.
- * Can be accessed only while using CScript.exe.
- */
- StdErr: TextStreamWriter;
-
- /**
- * Exposes the write-only output stream for the current script.
- * Can be accessed only while using CScript.exe.
- */
- StdOut: TextStreamWriter;
- Arguments: { length: number; Item(n: number): string; };
-
- /**
- * The full path of the currently running script.
- */
- ScriptFullName: string;
-
- /**
- * Forces the script to stop immediately, with an optional exit code.
- */
- Quit(exitCode?: number): number;
-
- /**
- * The Windows Script Host build version number.
- */
- BuildVersion: number;
-
- /**
- * Fully qualified path of the host executable.
- */
- FullName: string;
-
- /**
- * Gets/sets the script mode - interactive(true) or batch(false).
- */
- Interactive: boolean;
-
- /**
- * The name of the host executable (WScript.exe or CScript.exe).
- */
- Name: string;
-
- /**
- * Path of the directory containing the host executable.
- */
- Path: string;
-
- /**
- * The filename of the currently running script.
- */
- ScriptName: string;
-
- /**
- * Exposes the read-only input stream for the current script.
- * Can be accessed only while using CScript.exe.
- */
- StdIn: TextStreamReader;
-
- /**
- * Windows Script Host version
- */
- Version: string;
-
- /**
- * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
- */
- ConnectObject(objEventSource: any, strPrefix: string): void;
-
- /**
- * Creates a COM object.
- * @param strProgiID
- * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
- */
- CreateObject(strProgID: string, strPrefix?: string): any;
-
- /**
- * Disconnects a COM object from its event sources.
- */
- DisconnectObject(obj: any): void;
-
- /**
- * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
- * @param strPathname Fully qualified path to the file containing the object persisted to disk.
- * For objects in memory, pass a zero-length string.
- * @param strProgID
- * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
- */
- GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
-
- /**
- * Suspends script execution for a specified length of time, then continues execution.
- * @param intTime Interval (in milliseconds) to suspend script execution.
- */
- Sleep(intTime: number): void;
-};
-
-/**
- * Allows enumerating over a COM collection, which may not have indexed item access.
- */
-interface Enumerator {
- /**
- * Returns true if the current item is the last one in the collection, or the collection is empty,
- * or the current item is undefined.
- */
- atEnd(): boolean;
-
- /**
- * Returns the current item in the collection
- */
- item(): T;
-
- /**
- * Resets the current item in the collection to the first item. If there are no items in the collection,
- * the current item is set to undefined.
- */
- moveFirst(): void;
-
- /**
- * Moves the current item to the next item in the collection. If the enumerator is at the end of
- * the collection or the collection is empty, the current item is set to undefined.
- */
- moveNext(): void;
-}
-
-interface EnumeratorConstructor {
- new (collection: any): Enumerator;
- new (collection: any): Enumerator;
-}
-
-declare var Enumerator: EnumeratorConstructor;
-
-/**
- * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
- */
-interface VBArray {
- /**
- * Returns the number of dimensions (1-based).
- */
- dimensions(): number;
-
- /**
- * Takes an index for each dimension in the array, and returns the item at the corresponding location.
- */
- getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
-
- /**
- * Returns the smallest available index for a given dimension.
- * @param dimension 1-based dimension (defaults to 1)
- */
- lbound(dimension?: number): number;
-
- /**
- * Returns the largest available index for a given dimension.
- * @param dimension 1-based dimension (defaults to 1)
- */
- ubound(dimension?: number): number;
-
- /**
- * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
- * each successive dimension is appended to the end of the array.
- * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
- */
- toArray(): T[];
-}
-
-interface VBArrayConstructor {
- new (safeArray: any): VBArray;
- new (safeArray: any): VBArray;
-}
-
-declare var VBArray: VBArrayConstructor;
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index 8356e1fcd87..bab554927e7 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -196,8 +196,8 @@ namespace ts {
traceEnabled
};
- // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set
- const rootDir = options.typesRoot || (options.configFilePath ? getDirectoryPath(options.configFilePath) : undefined);
+ // use typesRoot and fallback to directory that contains tsconfig or current directory if typesRoot is not set
+ const rootDir = options.typesRoot || (options.configFilePath ? getDirectoryPath(options.configFilePath) : (host.getCurrentDirectory && host.getCurrentDirectory()));
if (traceEnabled) {
if (containingFile === undefined) {
@@ -875,6 +875,19 @@ namespace ts {
}
}
+ function getDefaultTypeDirectiveNames(rootPath: string): string[] {
+ const localTypes = combinePaths(rootPath, "types");
+ const npmTypes = combinePaths(rootPath, "node_modules/@types");
+ let result: string[] = [];
+ if (sys.directoryExists(localTypes)) {
+ result = result.concat(sys.getDirectories(localTypes));
+ }
+ if (sys.directoryExists(npmTypes)) {
+ result = result.concat(sys.getDirectories(npmTypes));
+ }
+ return result;
+ }
+
function getDefaultLibLocation(): string {
return getDirectoryPath(normalizePath(sys.getExecutingFilePath()));
}
@@ -883,6 +896,7 @@ namespace ts {
const realpath = sys.realpath && ((path: string) => sys.realpath(path));
return {
+ getDefaultTypeDirectiveNames,
getSourceFile,
getDefaultLibLocation,
getDefaultLibFileName: options => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options)),
@@ -958,6 +972,23 @@ namespace ts {
return resolutions;
}
+ export function getDefaultTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[] {
+ // Use explicit type list from tsconfig.json
+ if (options.types) {
+ return options.types;
+ }
+
+ // or load all types from the automatic type import fields
+ if (host && host.getDefaultTypeDirectiveNames) {
+ const commonRoot = computeCommonSourceDirectoryOfFilenames(rootFiles, host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
+ if (commonRoot) {
+ return host.getDefaultTypeDirectiveNames(commonRoot);
+ }
+ }
+
+ return undefined;
+ }
+
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program {
let program: Program;
let files: SourceFile[] = [];
@@ -1005,15 +1036,18 @@ namespace ts {
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? createFileMap(fileName => fileName.toLowerCase()) : undefined;
if (!tryReuseStructureFromOldProgram()) {
+ forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
+
// load type declarations specified via 'types' argument
- if (options.types && options.types.length) {
- const resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined);
- for (let i = 0; i < options.types.length; i++) {
- processTypeReferenceDirective(options.types[i], resolutions[i]);
+ const typeReferences: string[] = getDefaultTypeDirectiveNames(options, rootNames, host);
+
+ if (typeReferences) {
+ const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, /*containingFile*/ undefined);
+ for (let i = 0; i < typeReferences.length; i++) {
+ processTypeReferenceDirective(typeReferences[i], resolutions[i]);
}
}
- forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
// Do not process the default library if:
// - The '--noLib' flag is used.
// - A 'no-default-lib' reference comment is encountered in
@@ -1909,20 +1943,7 @@ namespace ts {
i < file.imports.length;
if (shouldAddFile) {
- const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
-
- if (importedFile && resolution.isExternalLibraryImport) {
- // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files,
- // this check is ok. Otherwise this would be never true for javascript file
- if (!isExternalModule(importedFile) && importedFile.statements.length) {
- const start = getTokenPosOfNode(file.imports[i], file);
- fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
- }
- else if (importedFile.referencedFiles.length) {
- const firstRef = importedFile.referencedFiles[0];
- fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
- }
- }
+ findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
}
}
}
diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts
index a9a39f42240..0c500d5500e 100644
--- a/src/compiler/sys.ts
+++ b/src/compiler/sys.ts
@@ -24,6 +24,7 @@ namespace ts {
createDirectory(path: string): void;
getExecutingFilePath(): string;
getCurrentDirectory(): string;
+ getDirectories(path: string): string[];
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
getModifiedTime?(path: string): Date;
createHash?(data: string): string;
@@ -71,6 +72,7 @@ namespace ts {
resolvePath(path: string): string;
readFile(path: string): string;
writeFile(path: string, contents: string): void;
+ getDirectories(path: string): string[];
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
@@ -161,6 +163,11 @@ namespace ts {
return result.sort();
}
+ function getDirectories(path: string): string[] {
+ const folder = fso.GetFolder(path);
+ return getNames(folder.subfolders);
+ }
+
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
const result: string[] = [];
exclude = map(exclude, s => getCanonicalPath(combinePaths(path, s)));
@@ -214,6 +221,7 @@ namespace ts {
getCurrentDirectory() {
return new ActiveXObject("WScript.Shell").CurrentDirectory;
},
+ getDirectories,
readDirectory,
exit(exitCode?: number): void {
try {
@@ -402,6 +410,10 @@ namespace ts {
return fileSystemEntryExists(path, FileSystemEntryKind.Directory);
}
+ function getDirectories(path: string): string[] {
+ return filter(_fs.readdirSync(path), p => fileSystemEntryExists(combinePaths(path, p), FileSystemEntryKind.Directory));
+ }
+
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
const result: string[] = [];
exclude = map(exclude, s => getCanonicalPath(combinePaths(path, s)));
@@ -507,6 +519,7 @@ namespace ts {
getCurrentDirectory() {
return process.cwd();
},
+ getDirectories,
readDirectory,
getModifiedTime(path) {
try {
@@ -561,6 +574,7 @@ namespace ts {
createDirectory: ChakraHost.createDirectory,
getExecutingFilePath: () => ChakraHost.executingFile,
getCurrentDirectory: () => ChakraHost.currentDirectory,
+ getDirectories: ChakraHost.getDirectories,
readDirectory: ChakraHost.readDirectory,
exit: ChakraHost.quit,
realpath
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 271285415c9..7613c489920 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -2786,6 +2786,7 @@ namespace ts {
trace?(s: string): void;
directoryExists?(directoryName: string): boolean;
realpath?(path: string): string;
+ getCurrentDirectory?(): string;
}
export interface ResolvedModule {
@@ -2822,6 +2823,7 @@ namespace ts {
getCancellationToken?(): CancellationToken;
getDefaultLibFileName(options: CompilerOptions): string;
getDefaultLibLocation?(): string;
+ getDefaultTypeDirectiveNames?(rootPath: string): string[];
writeFile: WriteFileCallback;
getCurrentDirectory(): string;
getCanonicalFileName(fileName: string): string;
diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts
index 1ddbd1ea331..d368293bd65 100644
--- a/src/harness/compilerRunner.ts
+++ b/src/harness/compilerRunner.ts
@@ -107,7 +107,7 @@ class CompilerBaselineRunner extends RunnerBase {
}
const output = Harness.Compiler.compileFiles(
- toBeCompiled, otherFiles, harnessSettings, /*options*/ tsConfigOptions, /*currentDirectory*/ undefined);
+ toBeCompiled, otherFiles, harnessSettings, /*options*/ tsConfigOptions, /*currentDirectory*/ harnessSettings["currentDirectory"]);
options = output.options;
result = output.result;
diff --git a/src/harness/harness.ts b/src/harness/harness.ts
index ef9b36b50e2..5b26829cf4a 100644
--- a/src/harness/harness.ts
+++ b/src/harness/harness.ts
@@ -127,7 +127,7 @@ namespace Utils {
export function memoize(f: T): T {
const cache: { [idx: string]: any } = {};
- return (function () {
+ return (function() {
const key = Array.prototype.join.call(arguments);
const cachedResult = cache[key];
if (cachedResult) {
@@ -609,7 +609,7 @@ namespace Harness {
export const getCurrentDirectory = () => "";
export const args = () => [];
export const getExecutingFilePath = () => "";
- export const exit = (exitCode: number) => {};
+ export const exit = (exitCode: number) => { };
export let log = (s: string) => console.log(s);
@@ -826,7 +826,7 @@ namespace Harness {
}
if (!libFileNameSourceFileMap[fileName]) {
- libFileNameSourceFileMap[fileName] = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest);
+ libFileNameSourceFileMap[fileName] = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest);
}
return libFileNameSourceFileMap[fileName];
}
@@ -900,6 +900,20 @@ namespace Harness {
return {
+ getDefaultTypeDirectiveNames: (path: string) => {
+ const results: string[] = [];
+ fileMap.forEachValue((key, value) => {
+ const rx = /node_modules\/@types\/(\w+)/;
+ const typeNameResult = rx.exec(key);
+ if (typeNameResult) {
+ const typeName = typeNameResult[1];
+ if (results.indexOf(typeName) < 0) {
+ results.push(typeName);
+ }
+ }
+ });
+ return results;
+ },
getCurrentDirectory: () => currentDirectory,
getSourceFile,
getDefaultLibFileName,
@@ -939,6 +953,7 @@ namespace Harness {
{ name: "noErrorTruncation", type: "boolean" },
{ name: "suppressOutputPathCheck", type: "boolean" },
{ name: "noImplicitReferences", type: "boolean" },
+ { name: "currentDirectory", type: "string" },
{ name: "symlink", type: "string" }
];
@@ -1441,12 +1456,12 @@ namespace Harness {
if (currentFileName) {
// Store result file
const newTestFile = {
- content: currentFileContent,
- name: currentFileName,
- fileOptions: currentFileOptions,
- originalFilePath: fileName,
- references: refs
- };
+ content: currentFileContent,
+ name: currentFileName,
+ fileOptions: currentFileOptions,
+ originalFilePath: fileName,
+ references: refs
+ };
testUnitData.push(newTestFile);
// Reset local data
@@ -1544,10 +1559,10 @@ namespace Harness {
function baselinePath(fileName: string, type: string, baselineFolder: string, subfolder?: string) {
if (subfolder !== undefined) {
- return Harness.userSpecifiedRoot + baselineFolder + "/" + subfolder + "/" + type + "/" + fileName;
+ return Harness.userSpecifiedRoot + baselineFolder + "/" + subfolder + "/" + type + "/" + fileName;
}
else {
- return Harness.userSpecifiedRoot + baselineFolder + "/" + type + "/" + fileName;
+ return Harness.userSpecifiedRoot + baselineFolder + "/" + type + "/" + fileName;
}
}
@@ -1616,7 +1631,7 @@ namespace Harness {
}
function writeComparison(expected: string, actual: string, relativeFileName: string, actualFileName: string, descriptionForDescribe: string) {
- const encoded_actual = Utils.encodeString(actual);
+ const encoded_actual = Utils.encodeString(actual);
if (expected != encoded_actual) {
// Overwrite & issue error
const errMsg = "The baseline file " + relativeFileName + " has changed.";
diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts
index 96f516632c7..bd370b3601b 100644
--- a/src/harness/harnessLanguageService.ts
+++ b/src/harness/harnessLanguageService.ts
@@ -182,6 +182,7 @@ namespace Harness.LanguageService {
class NativeLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceHost {
getCompilationSettings() { return this.settings; }
getCancellationToken() { return this.cancellationToken; }
+ getDirectories(path: string): string[] { return []; }
getCurrentDirectory(): string { return ""; }
getDefaultLibFileName(): string { return Harness.Compiler.defaultLibFileName; }
getScriptFileNames(): string[] { return this.getFilenames(); }
@@ -268,6 +269,7 @@ namespace Harness.LanguageService {
getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); }
getCancellationToken(): ts.HostCancellationToken { return this.nativeHost.getCancellationToken(); }
getCurrentDirectory(): string { return this.nativeHost.getCurrentDirectory(); }
+ getDirectories(path: string) { return this.nativeHost.getDirectories(path); }
getDefaultLibFileName(): string { return this.nativeHost.getDefaultLibFileName(); }
getScriptFileNames(): string { return JSON.stringify(this.nativeHost.getScriptFileNames()); }
getScriptSnapshot(fileName: string): ts.ScriptSnapshotShim {
@@ -600,6 +602,10 @@ namespace Harness.LanguageService {
return this.host.getCurrentDirectory();
}
+ getDirectories(path: string): string[] {
+ return [];
+ }
+
readDirectory(path: string, extension?: string): string[] {
throw new Error("Not implemented Yet.");
}
diff --git a/src/services/shims.ts b/src/services/shims.ts
index a515f32d169..eb9c28ff7ac 100644
--- a/src/services/shims.ts
+++ b/src/services/shims.ts
@@ -61,6 +61,7 @@ namespace ts {
getLocalizedDiagnosticMessages(): string;
getCancellationToken(): HostCancellationToken;
getCurrentDirectory(): string;
+ getDirectories(path: string): string[];
getDefaultLibFileName(options: string): string;
getNewLine?(): string;
getProjectVersion?(): string;
@@ -400,6 +401,10 @@ namespace ts {
return this.shimHost.getCurrentDirectory();
}
+ public getDirectories(path: string): string[] {
+ return this.shimHost.getDirectories(path);
+ }
+
public getDefaultLibFileName(options: CompilerOptions): string {
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
}
diff --git a/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt b/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt
deleted file mode 100644
index 58111c777f1..00000000000
--- a/tests/baselines/reference/jsFileCompilationExternalPackageError.errors.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-tests/cases/compiler/moduleA/a.js(2,17): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/b.ts' is not a module. Please contact the package author to update the package definition.
-
-
-==== tests/cases/compiler/moduleA/a.js (1 errors) ====
-
- import {a} from "b";
- ~~~
-!!! error TS2656: Exported external package typings file 'b.ts' is not a module. Please contact the package author to update the package definition.
- a++;
- import {c} from "c";
- c++;
-
-==== tests/cases/compiler/node_modules/b.ts (0 errors) ====
- var a = 10;
-
-==== tests/cases/compiler/node_modules/c.js (0 errors) ====
- exports.a = 10;
- c = 10;
-
\ No newline at end of file
diff --git a/tests/baselines/reference/jsFileCompilationExternalPackageError.symbols b/tests/baselines/reference/jsFileCompilationExternalPackageError.symbols
new file mode 100644
index 00000000000..fcb678c3e6c
--- /dev/null
+++ b/tests/baselines/reference/jsFileCompilationExternalPackageError.symbols
@@ -0,0 +1,25 @@
+=== tests/cases/compiler/moduleA/a.js ===
+
+import {a} from "b";
+>a : Symbol(a, Decl(a.js, 1, 8))
+
+a++;
+>a : Symbol(a, Decl(a.js, 1, 8))
+
+import {c} from "c";
+>c : Symbol(c, Decl(a.js, 3, 8))
+
+c++;
+>c : Symbol(c, Decl(a.js, 3, 8))
+
+=== tests/cases/compiler/node_modules/b.ts ===
+var a = 10;
+>a : Symbol(a, Decl(b.ts, 0, 3))
+
+=== tests/cases/compiler/node_modules/c.js ===
+exports.a = 10;
+>exports : Symbol(a, Decl(c.js, 0, 0))
+>a : Symbol(a, Decl(c.js, 0, 0))
+
+c = 10;
+
diff --git a/tests/baselines/reference/jsFileCompilationExternalPackageError.types b/tests/baselines/reference/jsFileCompilationExternalPackageError.types
new file mode 100644
index 00000000000..ae2eb085f28
--- /dev/null
+++ b/tests/baselines/reference/jsFileCompilationExternalPackageError.types
@@ -0,0 +1,34 @@
+=== tests/cases/compiler/moduleA/a.js ===
+
+import {a} from "b";
+>a : any
+
+a++;
+>a++ : number
+>a : any
+
+import {c} from "c";
+>c : any
+
+c++;
+>c++ : number
+>c : any
+
+=== tests/cases/compiler/node_modules/b.ts ===
+var a = 10;
+>a : number
+>10 : number
+
+=== tests/cases/compiler/node_modules/c.js ===
+exports.a = 10;
+>exports.a = 10 : number
+>exports.a : any
+>exports : any
+>a : any
+>10 : number
+
+c = 10;
+>c = 10 : number
+>c : any
+>10 : number
+
diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json
index e0af1e39c5a..62d828d57d6 100644
--- a/tests/baselines/reference/library-reference-11.trace.json
+++ b/tests/baselines/reference/library-reference-11.trace.json
@@ -1,6 +1,14 @@
[
- "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
+ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/jquery/package.json' does not exist.",
+ "File '/types/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/jquery/package.json' does not exist.",
+ "File '/node_modules/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/jquery/package.json' does not exist.",
+ "File '/node_modules/@types/jquery/index.d.ts' does not exist.",
"Looking up in 'node_modules' folder, initial location '/a/b'",
"File '/a/b/node_modules/jquery.ts' does not exist.",
"File '/a/b/node_modules/jquery.d.ts' does not exist.",
diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json
index 2cdf1f5f20a..abe1f6c0f46 100644
--- a/tests/baselines/reference/library-reference-12.trace.json
+++ b/tests/baselines/reference/library-reference-12.trace.json
@@ -1,6 +1,14 @@
[
- "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
+ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/jquery/package.json' does not exist.",
+ "File '/types/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/jquery/package.json' does not exist.",
+ "File '/node_modules/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/jquery/package.json' does not exist.",
+ "File '/node_modules/@types/jquery/index.d.ts' does not exist.",
"Looking up in 'node_modules' folder, initial location '/a/b'",
"File '/a/b/node_modules/jquery.ts' does not exist.",
"File '/a/b/node_modules/jquery.d.ts' does not exist.",
diff --git a/tests/baselines/reference/library-reference-15.trace.json b/tests/baselines/reference/library-reference-15.trace.json
index 9a19d75ffac..b8029a0b61f 100644
--- a/tests/baselines/reference/library-reference-15.trace.json
+++ b/tests/baselines/reference/library-reference-15.trace.json
@@ -1,5 +1,24 @@
[
- "======== Resolving type reference directive 'jquery', containing file not set, root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
- "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."
+ "======== Resolving type reference directive 'jquery', containing file not set, root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/jquery/package.json' does not exist.",
+ "File '/types/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/jquery/package.json' does not exist.",
+ "File '/node_modules/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/jquery/package.json' does not exist.",
+ "File '/node_modules/@types/jquery/index.d.ts' does not exist.",
+ "Looking up in 'node_modules' folder, initial location '/'",
+ "File '/node_modules/jquery.ts' does not exist.",
+ "File '/node_modules/jquery.d.ts' does not exist.",
+ "File '/node_modules/jquery/package.json' does not exist.",
+ "File '/node_modules/jquery/index.ts' does not exist.",
+ "File '/node_modules/jquery/index.d.ts' does not exist.",
+ "File '/node_modules/@types/jquery.ts' does not exist.",
+ "File '/node_modules/@types/jquery.d.ts' does not exist.",
+ "File '/node_modules/@types/jquery/package.json' does not exist.",
+ "File '/node_modules/@types/jquery/index.ts' does not exist.",
+ "File '/node_modules/@types/jquery/index.d.ts' does not exist.",
+ "======== Type reference directive 'jquery' was not resolved. ========"
]
\ No newline at end of file
diff --git a/tests/baselines/reference/library-reference-5.trace.json b/tests/baselines/reference/library-reference-5.trace.json
index 272009782b5..ad34e9e3159 100644
--- a/tests/baselines/reference/library-reference-5.trace.json
+++ b/tests/baselines/reference/library-reference-5.trace.json
@@ -1,44 +1,30 @@
[
- "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
- "Looking up in 'node_modules' folder, initial location '/src'",
- "File '/src/node_modules/foo.ts' does not exist.",
- "File '/src/node_modules/foo.d.ts' does not exist.",
- "File '/src/node_modules/foo/package.json' does not exist.",
- "File '/src/node_modules/foo/index.ts' does not exist.",
- "File '/src/node_modules/foo/index.d.ts' does not exist.",
- "File '/src/node_modules/@types/foo.ts' does not exist.",
- "File '/src/node_modules/@types/foo.d.ts' does not exist.",
- "File '/src/node_modules/@types/foo/package.json' does not exist.",
- "File '/src/node_modules/@types/foo/index.ts' does not exist.",
- "File '/src/node_modules/@types/foo/index.d.ts' does not exist.",
- "File '/node_modules/foo.ts' does not exist.",
- "File '/node_modules/foo.d.ts' does not exist.",
+ "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/foo/package.json' does not exist.",
+ "File '/types/foo/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
"File '/node_modules/foo/package.json' does not exist.",
- "File '/node_modules/foo/index.ts' does not exist.",
"File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.",
- "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========",
- "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
- "Looking up in 'node_modules' folder, initial location '/src'",
- "File '/src/node_modules/bar.ts' does not exist.",
- "File '/src/node_modules/bar.d.ts' does not exist.",
- "File '/src/node_modules/bar/package.json' does not exist.",
- "File '/src/node_modules/bar/index.ts' does not exist.",
- "File '/src/node_modules/bar/index.d.ts' does not exist.",
- "File '/src/node_modules/@types/bar.ts' does not exist.",
- "File '/src/node_modules/@types/bar.d.ts' does not exist.",
- "File '/src/node_modules/@types/bar/package.json' does not exist.",
- "File '/src/node_modules/@types/bar/index.ts' does not exist.",
- "File '/src/node_modules/@types/bar/index.d.ts' does not exist.",
- "File '/node_modules/bar.ts' does not exist.",
- "File '/node_modules/bar.d.ts' does not exist.",
+ "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: true. ========",
+ "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/bar/package.json' does not exist.",
+ "File '/types/bar/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
"File '/node_modules/bar/package.json' does not exist.",
- "File '/node_modules/bar/index.ts' does not exist.",
"File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.",
- "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========",
- "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
+ "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: true. ========",
+ "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/alpha/package.json' does not exist.",
+ "File '/types/alpha/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/alpha/package.json' does not exist.",
+ "File '/node_modules/alpha/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/alpha/package.json' does not exist.",
+ "File '/node_modules/@types/alpha/index.d.ts' does not exist.",
"Looking up in 'node_modules' folder, initial location '/node_modules/foo'",
"File '/node_modules/foo/node_modules/alpha.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.",
@@ -46,8 +32,16 @@
"File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========",
- "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
+ "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/alpha/package.json' does not exist.",
+ "File '/types/alpha/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/alpha/package.json' does not exist.",
+ "File '/node_modules/alpha/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/alpha/package.json' does not exist.",
+ "File '/node_modules/@types/alpha/index.d.ts' does not exist.",
"Looking up in 'node_modules' folder, initial location '/node_modules/bar'",
"File '/node_modules/bar/node_modules/alpha.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.",
diff --git a/tests/baselines/reference/library-reference-7.trace.json b/tests/baselines/reference/library-reference-7.trace.json
index 419fe6d055d..9c6b19390d0 100644
--- a/tests/baselines/reference/library-reference-7.trace.json
+++ b/tests/baselines/reference/library-reference-7.trace.json
@@ -1,6 +1,14 @@
[
- "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory not set. ========",
- "Root directory cannot be determined, skipping primary search paths.",
+ "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/jquery/package.json' does not exist.",
+ "File '/types/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/'",
+ "File '/node_modules/jquery/package.json' does not exist.",
+ "File '/node_modules/jquery/index.d.ts' does not exist.",
+ "Resolving with primary search path '/node_modules/@types/'",
+ "File '/node_modules/@types/jquery/package.json' does not exist.",
+ "File '/node_modules/@types/jquery/index.d.ts' does not exist.",
"Looking up in 'node_modules' folder, initial location '/src'",
"File '/src/node_modules/jquery.ts' does not exist.",
"File '/src/node_modules/jquery.d.ts' does not exist.",
diff --git a/tests/baselines/reference/nodeResolution5.errors.txt b/tests/baselines/reference/nodeResolution5.errors.txt
deleted file mode 100644
index c36cce45b6d..00000000000
--- a/tests/baselines/reference/nodeResolution5.errors.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a.d.ts' is not a module. Please contact the package author to update the package definition.
-
-
-==== tests/cases/compiler/b.ts (1 errors) ====
- import y = require("a");
- ~~~
-!!! error TS2656: Exported external package typings file 'a.d.ts' is not a module. Please contact the package author to update the package definition.
-
-==== tests/cases/compiler/node_modules/a.d.ts (0 errors) ====
-
- declare module "a" {
- var x: number;
- }
-
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeResolution5.symbols b/tests/baselines/reference/nodeResolution5.symbols
new file mode 100644
index 00000000000..be4aa2be0e9
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution5.symbols
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : Symbol(y, Decl(b.ts, 0, 0))
+
+=== tests/cases/compiler/node_modules/a.d.ts ===
+
+declare module "a" {
+ var x: number;
+>x : Symbol(x, Decl(a.d.ts, 2, 7))
+}
+
diff --git a/tests/baselines/reference/nodeResolution5.types b/tests/baselines/reference/nodeResolution5.types
new file mode 100644
index 00000000000..14f5bd24f5d
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution5.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : typeof y
+
+=== tests/cases/compiler/node_modules/a.d.ts ===
+
+declare module "a" {
+ var x: number;
+>x : number
+}
+
diff --git a/tests/baselines/reference/nodeResolution6.errors.txt b/tests/baselines/reference/nodeResolution6.errors.txt
deleted file mode 100644
index 6bab6e34389..00000000000
--- a/tests/baselines/reference/nodeResolution6.errors.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
-
-
-==== tests/cases/compiler/b.ts (0 errors) ====
- import y = require("a");
-
-==== tests/cases/compiler/node_modules/ref.ts (0 errors) ====
-
- var x = 1;
-
-==== tests/cases/compiler/node_modules/a.d.ts (1 errors) ====
- ///
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
- export declare var y;
-
-
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeResolution6.symbols b/tests/baselines/reference/nodeResolution6.symbols
new file mode 100644
index 00000000000..075f94e7992
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution6.symbols
@@ -0,0 +1,15 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : Symbol(y, Decl(b.ts, 0, 0))
+
+=== tests/cases/compiler/node_modules/ref.ts ===
+
+var x = 1;
+>x : Symbol(x, Decl(ref.ts, 1, 3))
+
+=== tests/cases/compiler/node_modules/a.d.ts ===
+///
+export declare var y;
+>y : Symbol(y, Decl(a.d.ts, 1, 18))
+
+
diff --git a/tests/baselines/reference/nodeResolution6.types b/tests/baselines/reference/nodeResolution6.types
new file mode 100644
index 00000000000..13c5d6d9276
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution6.types
@@ -0,0 +1,16 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : typeof y
+
+=== tests/cases/compiler/node_modules/ref.ts ===
+
+var x = 1;
+>x : number
+>1 : number
+
+=== tests/cases/compiler/node_modules/a.d.ts ===
+///
+export declare var y;
+>y : any
+
+
diff --git a/tests/baselines/reference/nodeResolution7.errors.txt b/tests/baselines/reference/nodeResolution7.errors.txt
deleted file mode 100644
index f9e8ef7ac0f..00000000000
--- a/tests/baselines/reference/nodeResolution7.errors.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a/index.d.ts' is not a module. Please contact the package author to update the package definition.
-
-
-==== tests/cases/compiler/b.ts (1 errors) ====
- import y = require("a");
- ~~~
-!!! error TS2656: Exported external package typings file 'index.d.ts' is not a module. Please contact the package author to update the package definition.
-
-==== tests/cases/compiler/node_modules/a/index.d.ts (0 errors) ====
-
- declare module "a" {
- var x: number;
- }
-
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeResolution7.symbols b/tests/baselines/reference/nodeResolution7.symbols
new file mode 100644
index 00000000000..ea8d636b61b
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution7.symbols
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : Symbol(y, Decl(b.ts, 0, 0))
+
+=== tests/cases/compiler/node_modules/a/index.d.ts ===
+
+declare module "a" {
+ var x: number;
+>x : Symbol(x, Decl(index.d.ts, 2, 7))
+}
+
diff --git a/tests/baselines/reference/nodeResolution7.types b/tests/baselines/reference/nodeResolution7.types
new file mode 100644
index 00000000000..1cb14150bde
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution7.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : typeof y
+
+=== tests/cases/compiler/node_modules/a/index.d.ts ===
+
+declare module "a" {
+ var x: number;
+>x : number
+}
+
diff --git a/tests/baselines/reference/nodeResolution8.errors.txt b/tests/baselines/reference/nodeResolution8.errors.txt
deleted file mode 100644
index 3f14a4313c8..00000000000
--- a/tests/baselines/reference/nodeResolution8.errors.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
-
-
-==== tests/cases/compiler/b.ts (0 errors) ====
- import y = require("a");
-==== tests/cases/compiler/node_modules/a/ref.ts (0 errors) ====
-
- var x = 1;
-
-==== tests/cases/compiler/node_modules/a/index.d.ts (1 errors) ====
- ///
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
- export declare var y;
-
-
\ No newline at end of file
diff --git a/tests/baselines/reference/nodeResolution8.symbols b/tests/baselines/reference/nodeResolution8.symbols
new file mode 100644
index 00000000000..27c0941c9b9
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution8.symbols
@@ -0,0 +1,15 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : Symbol(y, Decl(b.ts, 0, 0))
+
+=== tests/cases/compiler/node_modules/a/ref.ts ===
+
+var x = 1;
+>x : Symbol(x, Decl(ref.ts, 1, 3))
+
+=== tests/cases/compiler/node_modules/a/index.d.ts ===
+///
+export declare var y;
+>y : Symbol(y, Decl(index.d.ts, 1, 18))
+
+
diff --git a/tests/baselines/reference/nodeResolution8.types b/tests/baselines/reference/nodeResolution8.types
new file mode 100644
index 00000000000..cced0d3008d
--- /dev/null
+++ b/tests/baselines/reference/nodeResolution8.types
@@ -0,0 +1,16 @@
+=== tests/cases/compiler/b.ts ===
+import y = require("a");
+>y : typeof y
+
+=== tests/cases/compiler/node_modules/a/ref.ts ===
+
+var x = 1;
+>x : number
+>1 : number
+
+=== tests/cases/compiler/node_modules/a/index.d.ts ===
+///
+export declare var y;
+>y : any
+
+
diff --git a/tests/baselines/reference/typeReferenceDirectives11.trace.json b/tests/baselines/reference/typeReferenceDirectives11.trace.json
index be060569d83..bfaae056c9e 100644
--- a/tests/baselines/reference/typeReferenceDirectives11.trace.json
+++ b/tests/baselines/reference/typeReferenceDirectives11.trace.json
@@ -1,12 +1,12 @@
[
- "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========",
- "Resolving with primary search path '/types/'",
- "File '/types/lib/package.json' does not exist.",
- "File '/types/lib/index.d.ts' exist - use it as a name resolution result.",
- "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========",
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module as file / folder, candidate module location '/mod1'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
- "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========"
+ "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
+ "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/lib/package.json' does not exist.",
+ "File '/types/lib/index.d.ts' exist - use it as a name resolution result.",
+ "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========"
]
\ No newline at end of file
diff --git a/tests/baselines/reference/typeReferenceDirectives8.trace.json b/tests/baselines/reference/typeReferenceDirectives8.trace.json
index be060569d83..bfaae056c9e 100644
--- a/tests/baselines/reference/typeReferenceDirectives8.trace.json
+++ b/tests/baselines/reference/typeReferenceDirectives8.trace.json
@@ -1,12 +1,12 @@
[
- "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========",
- "Resolving with primary search path '/types/'",
- "File '/types/lib/package.json' does not exist.",
- "File '/types/lib/index.d.ts' exist - use it as a name resolution result.",
- "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========",
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module as file / folder, candidate module location '/mod1'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
- "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========"
+ "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
+ "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========",
+ "Resolving with primary search path '/types/'",
+ "File '/types/lib/package.json' does not exist.",
+ "File '/types/lib/index.d.ts' exist - use it as a name resolution result.",
+ "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========"
]
\ No newline at end of file
diff --git a/tests/baselines/reference/typingsLookup1.js b/tests/baselines/reference/typingsLookup1.js
new file mode 100644
index 00000000000..1f89a2277aa
--- /dev/null
+++ b/tests/baselines/reference/typingsLookup1.js
@@ -0,0 +1,11 @@
+//// [tests/cases/conformance/typings/typingsLookup1.ts] ////
+
+//// [index.d.ts]
+declare var $: { x: any };
+
+//// [a.ts]
+$.x;
+
+
+//// [a.js]
+$.x;
diff --git a/tests/baselines/reference/typingsLookup1.symbols b/tests/baselines/reference/typingsLookup1.symbols
new file mode 100644
index 00000000000..8a21252d123
--- /dev/null
+++ b/tests/baselines/reference/typingsLookup1.symbols
@@ -0,0 +1,11 @@
+=== tests/cases/conformance/typings/a.ts ===
+$.x;
+>$.x : Symbol(x, Decl(index.d.ts, 0, 16))
+>$ : Symbol($, Decl(index.d.ts, 0, 11))
+>x : Symbol(x, Decl(index.d.ts, 0, 16))
+
+=== tests/cases/conformance/typings/node_modules/@types/jquery/index.d.ts ===
+declare var $: { x: any };
+>$ : Symbol($, Decl(index.d.ts, 0, 11))
+>x : Symbol(x, Decl(index.d.ts, 0, 16))
+
diff --git a/tests/baselines/reference/typingsLookup1.types b/tests/baselines/reference/typingsLookup1.types
new file mode 100644
index 00000000000..ca79a8248d5
--- /dev/null
+++ b/tests/baselines/reference/typingsLookup1.types
@@ -0,0 +1,11 @@
+=== tests/cases/conformance/typings/a.ts ===
+$.x;
+>$.x : any
+>$ : { x: any; }
+>x : any
+
+=== tests/cases/conformance/typings/node_modules/@types/jquery/index.d.ts ===
+declare var $: { x: any };
+>$ : { x: any; }
+>x : any
+
diff --git a/tests/cases/conformance/references/library-reference-11.ts b/tests/cases/conformance/references/library-reference-11.ts
index 39c8af56543..6708ceb4ab3 100644
--- a/tests/cases/conformance/references/library-reference-11.ts
+++ b/tests/cases/conformance/references/library-reference-11.ts
@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
+// @currentDirectory: /
// package.json in a secondary reference can refer to another file
diff --git a/tests/cases/conformance/references/library-reference-12.ts b/tests/cases/conformance/references/library-reference-12.ts
index c61d6d916ff..3db7fd3bc6f 100644
--- a/tests/cases/conformance/references/library-reference-12.ts
+++ b/tests/cases/conformance/references/library-reference-12.ts
@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
+// @currentDirectory: /
// package.json in a secondary reference can refer to another file
diff --git a/tests/cases/conformance/references/library-reference-15.ts b/tests/cases/conformance/references/library-reference-15.ts
index 92c96e74c97..dd2179d1af6 100644
--- a/tests/cases/conformance/references/library-reference-15.ts
+++ b/tests/cases/conformance/references/library-reference-15.ts
@@ -1,6 +1,7 @@
// @noImplicitReferences: true
// @traceResolution: true
// @types: jquery
+// @currentDirectory: /
// @filename: /a/types/jquery/index.d.ts
declare var $: { foo(): void };
diff --git a/tests/cases/conformance/references/library-reference-5.ts b/tests/cases/conformance/references/library-reference-5.ts
index 4660da00a2a..1fe327a1c69 100644
--- a/tests/cases/conformance/references/library-reference-5.ts
+++ b/tests/cases/conformance/references/library-reference-5.ts
@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
+// @currentDirectory: /
// Secondary references may not be duplicated if they disagree in content
diff --git a/tests/cases/conformance/references/library-reference-7.ts b/tests/cases/conformance/references/library-reference-7.ts
index e938aef7d3a..a5052415562 100644
--- a/tests/cases/conformance/references/library-reference-7.ts
+++ b/tests/cases/conformance/references/library-reference-7.ts
@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
+// @currentDirectory: /
// Secondary references are possible
diff --git a/tests/cases/conformance/typings/typingsLookup1.ts b/tests/cases/conformance/typings/typingsLookup1.ts
new file mode 100644
index 00000000000..702bd4bc21c
--- /dev/null
+++ b/tests/cases/conformance/typings/typingsLookup1.ts
@@ -0,0 +1,10 @@
+// @noImplicitReferences: true
+
+// @filename: tsconfig.json
+{ "files": "a.ts" }
+
+// @filename: node_modules/@types/jquery/index.d.ts
+declare var $: { x: any };
+
+// @filename: a.ts
+$.x;
diff --git a/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts
index 5c67d6b9269..bcac28749b6 100644
--- a/tests/cases/unittests/cachingInServerLSHost.ts
+++ b/tests/cases/unittests/cachingInServerLSHost.ts
@@ -46,6 +46,7 @@ namespace ts {
getCurrentDirectory: (): string => {
return "";
},
+ getDirectories: (path: string) => [],
readDirectory: (path: string, extension?: string, exclude?: string[]): string[] => {
throw new Error("NYI");
},
diff --git a/tests/cases/unittests/session.ts b/tests/cases/unittests/session.ts
index 1dcc3d9d68a..a2edb05b39b 100644
--- a/tests/cases/unittests/session.ts
+++ b/tests/cases/unittests/session.ts
@@ -14,6 +14,7 @@ namespace ts.server {
resolvePath(): string { return void 0; },
fileExists: () => false,
directoryExists: () => false,
+ getDirectories: () => [],
createDirectory(): void {},
getExecutingFilePath(): string { return void 0; },
getCurrentDirectory(): string { return void 0; },