Skip to content

Commit 4a808aa

Browse files
committed
Add tests when realpath supresses the casing error
1 parent 42165a1 commit 4a808aa

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

src/testRunner/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"unittests/tsc/cancellationToken.ts",
152152
"unittests/tsc/composite.ts",
153153
"unittests/tsc/declarationEmit.ts",
154+
"unittests/tsc/forceConsistentCasingInFileNames.ts",
154155
"unittests/tsc/incremental.ts",
155156
"unittests/tsc/listFilesOnly.ts",
156157
"unittests/tsc/projectReferences.ts",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace ts {
2+
describe("unittests:: tsc:: forceConsistentCasingInFileNames::", () => {
3+
verifyTsc({
4+
scenario: "forceConsistentCasingInFileNames",
5+
subScenario: "with relative and non relative file resolutions",
6+
commandLineArgs: ["/src/project/src/struct.d.ts", "--forceConsistentCasingInFileNames", "--explainFiles"],
7+
fs: () => loadProjectFromFiles({
8+
"/src/project/src/struct.d.ts": Utils.dedent`
9+
import * as xs1 from "fp-ts/lib/Struct";
10+
import * as xs2 from "fp-ts/lib/struct";
11+
import * as xs3 from "./Struct";
12+
import * as xs4 from "./struct";
13+
`,
14+
"/src/project/node_modules/fp-ts/lib/struct.d.ts": `export function foo(): void`,
15+
}),
16+
});
17+
});
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Input::
2+
//// [/lib/lib.d.ts]
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
16+
17+
//// [/src/project/node_modules/fp-ts/lib/struct.d.ts]
18+
export function foo(): void
19+
20+
//// [/src/project/src/struct.d.ts]
21+
import * as xs1 from "fp-ts/lib/Struct";
22+
import * as xs2 from "fp-ts/lib/struct";
23+
import * as xs3 from "./Struct";
24+
import * as xs4 from "./struct";
25+
26+
27+
28+
29+
Output::
30+
/lib/tsc /src/project/src/struct.d.ts --forceConsistentCasingInFileNames --explainFiles
31+
src/project/src/struct.d.ts:3:22 - error TS1149: File name '/src/project/src/Struct.d.ts' differs from already included file name '/src/project/src/struct.d.ts' only in casing.
32+
The file is in the program because:
33+
Root file specified for compilation
34+
Imported via "./Struct" from file '/src/project/src/struct.d.ts'
35+
Imported via "./struct" from file '/src/project/src/struct.d.ts'
36+
37+
3 import * as xs3 from "./Struct";
38+
   ~~~~~~~~~~
39+
40+
src/project/src/struct.d.ts:4:22
41+
4 import * as xs4 from "./struct";
42+
   ~~~~~~~~~~
43+
File is included via import here.
44+
45+
lib/lib.d.ts
46+
Default library for target 'es3'
47+
src/project/node_modules/fp-ts/lib/struct.d.ts
48+
Imported via "fp-ts/lib/Struct" from file 'src/project/src/struct.d.ts'
49+
Imported via "fp-ts/lib/struct" from file 'src/project/src/struct.d.ts'
50+
src/project/src/struct.d.ts
51+
Root file specified for compilation
52+
Imported via "./Struct" from file 'src/project/src/struct.d.ts'
53+
Imported via "./struct" from file 'src/project/src/struct.d.ts'
54+
55+
Found 1 error in src/project/src/struct.d.ts:3
56+
57+
exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
58+
59+

0 commit comments

Comments
 (0)