diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index 2c61399668..6bbf9a13d0 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -459,6 +459,10 @@ module ts {
return normalizedPathComponents(path, rootLength);
}
+ export function getNormalizedAbsolutePath(filename: string, currentDirectory: string) {
+ return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory));
+ }
+
export function getNormalizedPathFromPathComponents(pathComponents: string[]) {
if (pathComponents && pathComponents.length) {
return pathComponents[0] + pathComponents.slice(1).join(directorySeparator);
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index 27258b571c..fb0023e9cb 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -57,7 +57,7 @@ module ts {
var newLine = program.getCompilerHost().getNewLine();
function getSourceFilePathInNewDir(newDirPath: string, sourceFile: SourceFile) {
- var sourceFilePath = getNormalizedPathFromPathComponents(getNormalizedPathComponents(sourceFile.filename, compilerHost.getCurrentDirectory()));
+ var sourceFilePath = getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory());
sourceFilePath = sourceFilePath.replace(program.getCommonSourceDirectory(), "");
return combinePaths(newDirPath, sourceFilePath);
}
@@ -3430,11 +3430,6 @@ module ts {
}
}
- function tryResolveScriptReference(sourceFile: SourceFile, reference: FileReference) {
- var referenceFileName = normalizePath(combinePaths(getDirectoryPath(sourceFile.filename), reference.filename));
- return program.getSourceFile(referenceFileName);
- }
-
// Contains the reference paths that needs to go in the declaration file.
// Collecting this separately because reference paths need to be first thing in the declaration file
// and we could be collecting these paths from multiple files into single one with --out option
@@ -3461,7 +3456,7 @@ module ts {
if (!compilerOptions.noResolve) {
var addedGlobalFileReference = false;
forEach(root.referencedFiles, fileReference => {
- var referencedFile = tryResolveScriptReference(root, fileReference);
+ var referencedFile = tryResolveScriptReference(program, root, fileReference);
// All the references that are not going to be part of same file
if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference
@@ -3486,7 +3481,7 @@ module ts {
// Check what references need to be added
if (!compilerOptions.noResolve) {
forEach(sourceFile.referencedFiles, fileReference => {
- var referencedFile = tryResolveScriptReference(sourceFile, fileReference);
+ var referencedFile = tryResolveScriptReference(program, sourceFile, fileReference);
// If the reference file is a declaration file or an external module, emit that reference
if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) &&
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 7173e299a3..18523f66dd 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -643,6 +643,14 @@ module ts {
return false;
}
+ export function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference) {
+ if (!program.getCompilerOptions().noResolve) {
+ var referenceFileName = isRootedDiskPath(reference.filename) ? reference.filename : combinePaths(getDirectoryPath(sourceFile.filename), reference.filename);
+ referenceFileName = getNormalizedAbsolutePath(referenceFileName, program.getCompilerHost().getCurrentDirectory());
+ return program.getSourceFile(referenceFileName);
+ }
+ }
+
export function getAncestor(node: Node, kind: SyntaxKind): Node {
switch (kind) {
// special-cases that can be come first
@@ -4695,13 +4703,15 @@ module ts {
var canonicalName = host.getCanonicalFileName(filename);
if (hasProperty(filesByName, canonicalName)) {
// We've already looked for this file, use cached result
- var file = filesByName[canonicalName];
- if (file && host.useCaseSensitiveFileNames() && canonicalName !== file.filename) {
- errors.push(createFileDiagnostic(refFile, refStart, refLength,
- Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, file.filename));
- }
+ return getSourceFileFromCache(filename, canonicalName, /*useAbsolutePath*/ false);
}
else {
+ var normalizedAbsolutePath = getNormalizedAbsolutePath(filename, host.getCurrentDirectory());
+ var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
+ if (hasProperty(filesByName, canonicalAbsolutePath)) {
+ return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true);
+ }
+
// We haven't looked for this file, do so now and cache result
var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, hostErrorMessage => {
errors.push(createFileDiagnostic(refFile, refStart, refLength,
@@ -4709,6 +4719,10 @@ module ts {
});
if (file) {
seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib;
+
+ // Set the source file for normalized absolute path
+ filesByName[canonicalAbsolutePath] = file;
+
if (!options.noResolve) {
var basePath = getDirectoryPath(filename);
processReferencedFiles(file, basePath);
@@ -4726,6 +4740,18 @@ module ts {
}
}
return file;
+
+ function getSourceFileFromCache(filename: string, canonicalName: string, useAbsolutePath: boolean): SourceFile {
+ var file = filesByName[canonicalName];
+ if (file && host.useCaseSensitiveFileNames()) {
+ var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.filename, host.getCurrentDirectory()) : file.filename;
+ if (canonicalName !== sourceFileName) {
+ errors.push(createFileDiagnostic(refFile, refStart, refLength,
+ Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, sourceFileName));
+ }
+ }
+ return file;
+ }
}
function processReferencedFiles(file: SourceFile, basePath: string) {
diff --git a/src/harness/harness.ts b/src/harness/harness.ts
index 5b6db22e1d..0ce9ee1643 100644
--- a/src/harness/harness.ts
+++ b/src/harness/harness.ts
@@ -866,7 +866,7 @@ module Harness {
var sourceFileName: string;
if (ts.isExternalModule(sourceFile) || !options.out) {
if (options.outDir) {
- var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, result.currentDirectoryForProgram));
+ var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, result.currentDirectoryForProgram);
sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), "");
sourceFileName = ts.combinePaths(options.outDir, sourceFilePath);
}
diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts
index e402c7c680..44cd3a6d95 100644
--- a/src/harness/projectsRunner.ts
+++ b/src/harness/projectsRunner.ts
@@ -17,6 +17,7 @@ interface ProjectRunnerTestCase {
baselineCheck?: boolean; // Verify the baselines of output files, if this is false, we will write to output to the disk but there is no verification of baselines
runTest?: boolean; // Run the resulting test
bug?: string; // If there is any bug associated with this test case
+ noResolve?: boolean;
}
interface ProjectRunnerTestCaseResolutionInfo extends ProjectRunnerTestCase {
@@ -162,7 +163,8 @@ class ProjectRunner extends RunnerBase {
outDir: testCase.outDir,
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? sys.resolvePath(testCase.mapRoot) : testCase.mapRoot,
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
- module: moduleKind
+ module: moduleKind,
+ noResolve: testCase.noResolve
};
}
@@ -272,16 +274,40 @@ class ProjectRunner extends RunnerBase {
}
function compileCompileDTsFiles(compilerResult: BatchCompileProjectTestCaseResult) {
- var inputDtsSourceFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(),
- sourceFile => Harness.Compiler.isDTS(sourceFile.filename)),
- sourceFile => {
- return { emittedFileName: sourceFile.filename, code: sourceFile.text };
- });
+ var allInputFiles: { emittedFileName: string; code: string; }[] = [];
+ var compilerOptions = compilerResult.program.getCompilerOptions();
+ var compilerHost = compilerResult.program.getCompilerHost();
+ ts.forEach(compilerResult.program.getSourceFiles(), sourceFile => {
+ if (Harness.Compiler.isDTS(sourceFile.filename)) {
+ allInputFiles.unshift({ emittedFileName: sourceFile.filename, code: sourceFile.text });
+ }
+ else if (ts.shouldEmitToOwnFile(sourceFile, compilerResult.program.getCompilerOptions())) {
+ if (compilerOptions.outDir) {
+ var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory());
+ sourceFilePath = sourceFilePath.replace(compilerResult.program.getCommonSourceDirectory(), "");
+ var emitOutputFilePathWithoutExtension = ts.removeFileExtension(ts.combinePaths(compilerOptions.outDir, sourceFilePath));
+ }
+ else {
+ var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.filename);
+ }
+
+ var outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts";
+ allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName));
+ }
+ else {
+ var outputDtsFileName = ts.removeFileExtension(compilerOptions.out) + ".d.ts";
+ var outputDtsFile = findOutpuDtsFile(outputDtsFileName);
+ if (!ts.contains(allInputFiles, outputDtsFile)) {
+ allInputFiles.unshift(outputDtsFile);
+ }
+ }
+ });
- var ouputDtsFiles = ts.filter(compilerResult.outputFiles, ouputFile => Harness.Compiler.isDTS(ouputFile.emittedFileName));
- var allInputFiles = inputDtsSourceFiles.concat(ouputDtsFiles);
return compileProjectFiles(compilerResult.moduleKind,getInputFiles, getSourceFileText, writeFile);
+ function findOutpuDtsFile(fileName: string) {
+ return ts.forEach(compilerResult.outputFiles, outputFile => outputFile.emittedFileName === fileName ? outputFile : undefined);
+ }
function getInputFiles() {
return ts.map(allInputFiles, outputFile => outputFile.emittedFileName);
}
diff --git a/src/services/services.ts b/src/services/services.ts
index 7f7a05cd3a..daec0102e6 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -3332,11 +3332,10 @@ module ts {
/// Triple slash reference comments
var comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined);
if (comment) {
- var targetFilename = isRootedDiskPath(comment.filename) ? comment.filename : combinePaths(getDirectoryPath(filename), comment.filename);
- targetFilename = normalizePath(targetFilename);
- if (program.getSourceFile(targetFilename)) {
+ var referenceFile = tryResolveScriptReference(program, sourceFile, comment);
+ if (referenceFile) {
return [{
- fileName: targetFilename,
+ fileName: referenceFile.filename,
textSpan: TextSpan.fromBounds(0, 0),
kind: ScriptElementKind.scriptElement,
name: comment.filename,
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile1.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/diskFile1.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json
new file mode 100644
index 0000000000..fe07bb38b9
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "../../../bar/bar.ts",
+ "foo.ts"
+ ],
+ "emittedFiles": [
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts",
+ "foo.js",
+ "foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile1.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/diskFile1.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json
new file mode 100644
index 0000000000..fe07bb38b9
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "../../../bar/bar.ts",
+ "foo.ts"
+ ],
+ "emittedFiles": [
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts",
+ "foo.js",
+ "foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.js b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/bar/bar.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json
new file mode 100644
index 0000000000..b24993bcf8
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromRootDirectory",
+ "projectRoot": "tests/cases/projects/ReferenceResolution",
+ "inputFiles": [
+ "src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "bar/bar.ts",
+ "src/ts/foo/foo.ts"
+ ],
+ "emittedFiles": [
+ "bar/bar.js",
+ "bar/bar.d.ts",
+ "src/ts/foo/foo.js",
+ "src/ts/foo/foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/src/ts/foo/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.js b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/bar/bar.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json
new file mode 100644
index 0000000000..b24993bcf8
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromRootDirectory",
+ "projectRoot": "tests/cases/projects/ReferenceResolution",
+ "inputFiles": [
+ "src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "bar/bar.ts",
+ "src/ts/foo/foo.ts"
+ ],
+ "emittedFiles": [
+ "bar/bar.js",
+ "bar/bar.d.ts",
+ "src/ts/foo/foo.js",
+ "src/ts/foo/foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/src/ts/foo/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile1.d.ts
new file mode 100644
index 0000000000..1e341d9785
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.d.ts
new file mode 100644
index 0000000000..0e91525d82
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.d.ts
@@ -0,0 +1,2 @@
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json
new file mode 100644
index 0000000000..16831b328e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json
@@ -0,0 +1,21 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts",
+ "../../../bar/bar.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "foo.ts",
+ "../../../bar/bar.ts"
+ ],
+ "emittedFiles": [
+ "foo.js",
+ "foo.d.ts",
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile1.d.ts
new file mode 100644
index 0000000000..1e341d9785
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.d.ts
new file mode 100644
index 0000000000..0e91525d82
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.d.ts
@@ -0,0 +1,2 @@
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json
new file mode 100644
index 0000000000..16831b328e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json
@@ -0,0 +1,21 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts",
+ "../../../bar/bar.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "foo.ts",
+ "../../../bar/bar.ts"
+ ],
+ "emittedFiles": [
+ "foo.js",
+ "foo.d.ts",
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile1.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/diskFile1.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json
new file mode 100644
index 0000000000..79b73ec775
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_RelativepathToFoo",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "../../../src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "../../../bar/bar.ts",
+ "../../../src/ts/foo/foo.ts"
+ ],
+ "emittedFiles": [
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts",
+ "../../../src/ts/foo/foo.js",
+ "../../../src/ts/foo/foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile0.js
new file mode 100644
index 0000000000..ae9742b492
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile0.js
@@ -0,0 +1,7 @@
+///
+// This is bar.ts
+var bar = (function () {
+ function bar() {
+ }
+ return bar;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile1.d.ts
new file mode 100644
index 0000000000..a21b762e1f
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/diskFile1.d.ts
@@ -0,0 +1,3 @@
+///
+declare class bar {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.d.ts b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.d.ts
new file mode 100644
index 0000000000..7f80d14325
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.d.ts
@@ -0,0 +1,3 @@
+///
+declare class foo {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.js b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.js
new file mode 100644
index 0000000000..20440d5c62
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/foo.js
@@ -0,0 +1,6 @@
+///
+var foo = (function () {
+ function foo() {
+ }
+ return foo;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json
new file mode 100644
index 0000000000..79b73ec775
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json
@@ -0,0 +1,20 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_RelativepathToFoo",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "../../../src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "../../../bar/bar.ts",
+ "../../../src/ts/foo/foo.ts"
+ ],
+ "emittedFiles": [
+ "../../../bar/bar.js",
+ "../../../bar/bar.d.ts",
+ "../../../src/ts/foo/foo.js",
+ "../../../src/ts/foo/foo.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile0.js
new file mode 100644
index 0000000000..c82f04ec51
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile0.js
@@ -0,0 +1,5 @@
+var test = (function () {
+ function test() {
+ }
+ return test;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile1.d.ts
new file mode 100644
index 0000000000..be748d27cf
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class test {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json
new file mode 100644
index 0000000000..9334271f8e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json
@@ -0,0 +1,18 @@
+{
+ "scenario": "referenceResolutionSameFileTwice",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "test.ts"
+ ],
+ "emittedFiles": [
+ "test.js",
+ "test.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile0.js
new file mode 100644
index 0000000000..c82f04ec51
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile0.js
@@ -0,0 +1,5 @@
+var test = (function () {
+ function test() {
+ }
+ return test;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile1.d.ts
new file mode 100644
index 0000000000..be748d27cf
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class test {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json
new file mode 100644
index 0000000000..9334271f8e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json
@@ -0,0 +1,18 @@
+{
+ "scenario": "referenceResolutionSameFileTwice",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "test.ts"
+ ],
+ "emittedFiles": [
+ "test.js",
+ "test.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile0.js
new file mode 100644
index 0000000000..c82f04ec51
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile0.js
@@ -0,0 +1,5 @@
+var test = (function () {
+ function test() {
+ }
+ return test;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile1.d.ts
new file mode 100644
index 0000000000..be748d27cf
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class test {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json
new file mode 100644
index 0000000000..b22aefac3e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json
@@ -0,0 +1,18 @@
+{
+ "scenario": "referenceResolutionSameFileTwice_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "test.ts"
+ ],
+ "emittedFiles": [
+ "test.js",
+ "test.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile0.js
new file mode 100644
index 0000000000..c82f04ec51
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile0.js
@@ -0,0 +1,5 @@
+var test = (function () {
+ function test() {
+ }
+ return test;
+})();
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile1.d.ts
new file mode 100644
index 0000000000..be748d27cf
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile1.d.ts
@@ -0,0 +1,2 @@
+declare class test {
+}
diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json
new file mode 100644
index 0000000000..b22aefac3e
--- /dev/null
+++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json
@@ -0,0 +1,18 @@
+{
+ "scenario": "referenceResolutionSameFileTwice_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true,
+ "resolvedInputFiles": [
+ "lib.d.ts",
+ "test.ts"
+ ],
+ "emittedFiles": [
+ "test.js",
+ "test.d.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionRelativePaths.json b/tests/cases/project/referenceResolutionRelativePaths.json
new file mode 100644
index 0000000000..f49fd03b22
--- /dev/null
+++ b/tests/cases/project/referenceResolutionRelativePaths.json
@@ -0,0 +1,9 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionRelativePathsFromRootDirectory.json b/tests/cases/project/referenceResolutionRelativePathsFromRootDirectory.json
new file mode 100644
index 0000000000..392d34a67a
--- /dev/null
+++ b/tests/cases/project/referenceResolutionRelativePathsFromRootDirectory.json
@@ -0,0 +1,9 @@
+{
+ "scenario": "referenceResolution1_FromRootDirectory",
+ "projectRoot": "tests/cases/projects/ReferenceResolution",
+ "inputFiles": [
+ "src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionRelativePathsNoResolve.json b/tests/cases/project/referenceResolutionRelativePathsNoResolve.json
new file mode 100644
index 0000000000..962f9d1a09
--- /dev/null
+++ b/tests/cases/project/referenceResolutionRelativePathsNoResolve.json
@@ -0,0 +1,11 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "foo.ts",
+ "../../../bar/bar.ts"
+ ],
+ "noResolve": true,
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionRelativePathsRelativeToRootDirectory.json b/tests/cases/project/referenceResolutionRelativePathsRelativeToRootDirectory.json
new file mode 100644
index 0000000000..ba8f2da83e
--- /dev/null
+++ b/tests/cases/project/referenceResolutionRelativePathsRelativeToRootDirectory.json
@@ -0,0 +1,9 @@
+{
+ "scenario": "referenceResolution1_FromFooFolder_RelativepathToFoo",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/src/ts/foo",
+ "inputFiles": [
+ "../../../src/ts/foo/foo.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionSameFileTwice.json b/tests/cases/project/referenceResolutionSameFileTwice.json
new file mode 100644
index 0000000000..00a8f6e103
--- /dev/null
+++ b/tests/cases/project/referenceResolutionSameFileTwice.json
@@ -0,0 +1,10 @@
+{
+ "scenario": "referenceResolutionSameFileTwice",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/project/referenceResolutionSameFileTwiceNoResolve.json b/tests/cases/project/referenceResolutionSameFileTwiceNoResolve.json
new file mode 100644
index 0000000000..8c77bd038c
--- /dev/null
+++ b/tests/cases/project/referenceResolutionSameFileTwiceNoResolve.json
@@ -0,0 +1,11 @@
+{
+ "scenario": "referenceResolutionSameFileTwice_NoResolve",
+ "projectRoot": "tests/cases/projects/ReferenceResolution/",
+ "inputFiles": [
+ "test.ts",
+ "../ReferenceResolution/test.ts"
+ ],
+ "noResolve": true,
+ "declaration": true,
+ "baselineCheck": true
+}
\ No newline at end of file
diff --git a/tests/cases/projects/ReferenceResolution/bar/bar.ts b/tests/cases/projects/ReferenceResolution/bar/bar.ts
new file mode 100644
index 0000000000..9fd38a32d6
--- /dev/null
+++ b/tests/cases/projects/ReferenceResolution/bar/bar.ts
@@ -0,0 +1,4 @@
+///
+// This is bar.ts
+class bar {
+}
\ No newline at end of file
diff --git a/tests/cases/projects/ReferenceResolution/src/ts/foo/foo.ts b/tests/cases/projects/ReferenceResolution/src/ts/foo/foo.ts
new file mode 100644
index 0000000000..2ea78e70fa
--- /dev/null
+++ b/tests/cases/projects/ReferenceResolution/src/ts/foo/foo.ts
@@ -0,0 +1,4 @@
+///
+
+class foo {
+}
\ No newline at end of file
diff --git a/tests/cases/projects/ReferenceResolution/test.ts b/tests/cases/projects/ReferenceResolution/test.ts
new file mode 100644
index 0000000000..212b620415
--- /dev/null
+++ b/tests/cases/projects/ReferenceResolution/test.ts
@@ -0,0 +1,2 @@
+class test {
+}
\ No newline at end of file