Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Tests
  • Loading branch information
sheetalkamat committed May 13, 2024
commit b407c7e9f9ee5d080d34891bbc99725feee3af40
15 changes: 15 additions & 0 deletions src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,19 @@ describe("unittests:: tsc:: forceConsistentCasingInFileNames::", () => {
commandLineArgs: ["-p", "/home/src/projects/project/tsconfig.json", "--explainFiles"],
fs: () => loadProjectFromFiles(getFsContentsForMultipleErrorsForceConsistentCasingInFileNames()),
});

verifyTsc({
scenario: "forceConsistentCasingInFileNames",
subScenario: "with type ref from file",
commandLineArgs: ["-p", "/src/project/src", "--explainFiles", "--traceResolution"],
fs: () =>
loadProjectFromFiles({
"/src/project/src/fileOne.d.ts": `declare class c { }`,
"/src/project/src/file2.d.ts": dedent`
/// <reference types="./fileOne.d.ts"/>
declare const y: c;
`,
"/src/project/src/tsconfig.json": "{ }",
}),
});
});
3 changes: 2 additions & 1 deletion src/testRunner/unittests/tsserver/typeReferenceDirectives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
libFile,
} from "../helpers/virtualFileSystemWithWatch.js";

describe("unittests:: tsserver:: typeReferenceDirectives", () => {
describe("unittests:: tsserver:: typeReferenceDirectives::", () => {
it("when typeReferenceDirective contains UpperCasePackage", () => {
const libProjectLocation = `/user/username/projects/myproject/lib`;
const typeLib: File = {
Expand Down Expand Up @@ -52,6 +52,7 @@ declare class TestLib {
compilerOptions: {
module: "amd",
typeRoots: ["../lib/@types", "../lib/@app"],
traceResolution: true,
},
}),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
currentDirectory:: / useCaseSensitiveFileNames: false
Input::
//// [/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };

//// [/src/project/src/file2.d.ts]
/// <reference types="./fileOne.d.ts"/>
declare const y: c;


//// [/src/project/src/fileOne.d.ts]
declare class c { }

//// [/src/project/src/tsconfig.json]
{ }



Output::
/lib/tsc -p /src/project/src --explainFiles --traceResolution
File '/src/project/src/package.json' does not exist.
File '/src/project/package.json' does not exist.
File '/src/package.json' does not exist.
File '/package.json' does not exist.
======== Resolving type reference directive './fileone.d.ts', containing file '/src/project/src/file2.d.ts', root directory '/src/project/src/node_modules/@types,/src/project/node_modules/@types,/src/node_modules/@types,/node_modules/@types'. ========
Resolving with primary search path '/src/project/src/node_modules/@types, /src/project/node_modules/@types, /src/node_modules/@types, /node_modules/@types'.
Directory '/src/project/src/node_modules/@types' does not exist, skipping all lookups in it.
Directory '/src/project/node_modules/@types' does not exist, skipping all lookups in it.
Directory '/src/node_modules/@types' does not exist, skipping all lookups in it.
Directory '/node_modules/@types' does not exist, skipping all lookups in it.
Looking up in 'node_modules' folder, initial location '/src/project/src'.
Loading module as file / folder, candidate module location '/src/project/src/fileone.d.ts', target file types: Declaration.
File name '/src/project/src/fileone.d.ts' has a '.d.ts' extension - stripping it.
File '/src/project/src/fileone.d.ts' exists - use it as a name resolution result.
Resolving real path for '/src/project/src/fileone.d.ts', result '/src/project/src/fileOne.d.ts'.
======== Type reference directive './fileone.d.ts' was successfully resolved to '/src/project/src/fileone.d.ts', primary: false. ========
File '/src/project/src/package.json' does not exist according to earlier cached lookups.
File '/src/project/package.json' does not exist according to earlier cached lookups.
File '/src/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/lib/package.json' does not exist.
File '/package.json' does not exist according to earlier cached lookups.
src/project/src/file2.d.ts:1:23 - error TS1261: Already included file name '/src/project/src/fileone.d.ts' differs from file name '/src/project/src/fileOne.d.ts' only in casing.
The file is in the program because:
Type library referenced via './fileOne.d.ts' from file '/src/project/src/file2.d.ts'
Matched by default include pattern '**/*'

1 /// <reference types="./fileOne.d.ts"/>
   ~~~~~~~~~~~~~~

lib/lib.d.ts
Default library for target 'es5'
src/project/src/fileone.d.ts
Type library referenced via './fileOne.d.ts' from file 'src/project/src/file2.d.ts'
Matched by default include pattern '**/*'
src/project/src/file2.d.ts
Matched by default include pattern '**/*'

Found 1 error in src/project/src/file2.d.ts:1

exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated


Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class TestClass1 {
"typeRoots": [
"../lib/@types",
"../lib/@app"
]
],
"traceResolution": true
}
}

Expand Down Expand Up @@ -87,16 +88,64 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/test/tsconfig
"/user/username/projects/myproject/lib/@types",
"/user/username/projects/myproject/lib/@app"
],
"traceResolution": true,
"configFilePath": "/user/username/projects/myproject/test/tsconfig.json"
}
}
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/test 1 undefined Config: /user/username/projects/myproject/test/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/test 1 undefined Config: /user/username/projects/myproject/test/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/test/tsconfig.json
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/test/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist.
Info seq [hh:mm:ss:mss] ======== Resolving type reference directive 'UpperCasePackage', containing file '/user/username/projects/myproject/test/__inferred type names__.ts', root directory '/user/username/projects/myproject/lib/@types,/user/username/projects/myproject/lib/@app'. ========
Info seq [hh:mm:ss:mss] Resolving with primary search path '/user/username/projects/myproject/lib/@types, /user/username/projects/myproject/lib/@app'.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/UpperCasePackage.d.ts' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/UpperCasePackage/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts' exists - use it as a name resolution result.
Info seq [hh:mm:ss:mss] Resolving real path for '/user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts', result '/user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts'.
Info seq [hh:mm:ss:mss] ======== Type reference directive 'UpperCasePackage' was successfully resolved to '/user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts', primary: true. ========
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib 1 undefined Project: /user/username/projects/myproject/test/tsconfig.json WatchType: Failed Lookup Locations
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib 1 undefined Project: /user/username/projects/myproject/test/tsconfig.json WatchType: Failed Lookup Locations
Info seq [hh:mm:ss:mss] ======== Resolving type reference directive 'lib', containing file '/user/username/projects/myproject/test/__inferred type names__.ts', root directory '/user/username/projects/myproject/lib/@types,/user/username/projects/myproject/lib/@app'. ========
Info seq [hh:mm:ss:mss] Resolving with primary search path '/user/username/projects/myproject/lib/@types, /user/username/projects/myproject/lib/@app'.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/lib.d.ts' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/lib.d.ts' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/lib/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/lib/index.d.ts' exists - use it as a name resolution result.
Info seq [hh:mm:ss:mss] Resolving real path for '/user/username/projects/myproject/lib/@app/lib/index.d.ts', result '/user/username/projects/myproject/lib/@app/lib/index.d.ts'.
Info seq [hh:mm:ss:mss] ======== Type reference directive 'lib' was successfully resolved to '/user/username/projects/myproject/lib/@app/lib/index.d.ts', primary: true. ========
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/UpperCasePackage/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib/@app/lib/index.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] ======== Resolving type reference directive 'uppercasepackage', containing file '/user/username/projects/myproject/lib/@app/lib/index.d.ts', root directory '/user/username/projects/myproject/lib/@types,/user/username/projects/myproject/lib/@app'. ========
Info seq [hh:mm:ss:mss] Resolving with primary search path '/user/username/projects/myproject/lib/@types, /user/username/projects/myproject/lib/@app'.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/uppercasepackage.d.ts' does not exist.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/uppercasepackage/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/uppercasepackage/index.d.ts' exists - use it as a name resolution result.
Info seq [hh:mm:ss:mss] Resolving real path for '/user/username/projects/myproject/lib/@types/uppercasepackage/index.d.ts', result '/user/username/projects/myproject/lib/@types/UpperCasePackage/index.d.ts'.
Info seq [hh:mm:ss:mss] ======== Type reference directive 'uppercasepackage' was successfully resolved to '/user/username/projects/myproject/lib/@types/uppercasepackage/index.d.ts', primary: true. ========
Info seq [hh:mm:ss:mss] File '/a/lib/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/a/package.json' does not exist.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib/@types 1 undefined Project: /user/username/projects/myproject/test/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/lib/@types 1 undefined Project: /user/username/projects/myproject/test/tsconfig.json WatchType: Type roots
Expand Down Expand Up @@ -159,7 +208,8 @@ Info seq [hh:mm:ss:mss] event:
"typeRoots": [
"",
""
]
],
"traceResolution": true
},
"typeAcquisition": {
"enable": false,
Expand Down Expand Up @@ -292,6 +342,32 @@ ScriptInfos::

Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/test/tsconfig.json
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/test/tsconfig.json
Info seq [hh:mm:ss:mss] File '/a/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/a/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/test/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/UpperCasePackage/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@types/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/@app/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/lib/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/username/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/user/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] File '/package.json' does not exist according to earlier cached lookups.
Info seq [hh:mm:ss:mss] Reusing resolution of type reference directive 'uppercasepackage' from '/user/username/projects/myproject/lib/@app/lib/index.d.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/lib/@types/uppercasepackage/index.d.ts'.
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/test/tsconfig.json projectStateVersion: 2 projectProgramVersion: 1 structureChanged: false structureIsReused:: Completely Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/test/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (4)
Expand Down