Skip to content

Commit 4615e52

Browse files
authored
Update more tests for paths (#53728)
1 parent 3e76fb5 commit 4615e52

8 files changed

+349
-341
lines changed

src/testRunner/unittests/tscWatch/resolutionCache.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution
1717
const scenario = "resolutionCache";
1818
it("caching works", () => {
1919
const root = {
20-
path: "/a/d/f0.ts",
20+
path: "/users/username/projects/project/d/f0.ts",
2121
content: `import {x} from "f1"`
2222
};
2323
const imported = {
24-
path: "/a/f1.ts",
24+
path: "/users/username/projects/project/f1.ts",
2525
content: `foo()`
2626
};
2727

@@ -99,12 +99,12 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution
9999

100100
it("loads missing files from disk", () => {
101101
const root = {
102-
path: `/a/foo.ts`,
102+
path: `/users/username/projects/project/foo.ts`,
103103
content: `import {x} from "bar"`
104104
};
105105

106106
const imported = {
107-
path: `/a/bar.d.ts`,
107+
path: `/users/username/projects/project/bar.d.ts`,
108108
content: `export const y = 1;`
109109
};
110110

@@ -157,12 +157,12 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution
157157

158158
it("should compile correctly when resolved module goes missing and then comes back (module is not part of the root)", () => {
159159
const root = {
160-
path: `/a/foo.ts`,
160+
path: `/users/username/projects/project/foo.ts`,
161161
content: `import {x} from "bar"`
162162
};
163163

164164
const imported = {
165-
path: `/a/bar.d.ts`,
165+
path: `/users/username/projects/project/bar.d.ts`,
166166
content: `export const y = 1;export const x = 10;`
167167
};
168168

@@ -262,18 +262,18 @@ declare module "fs" {
262262
verifyTscWatch({
263263
scenario,
264264
subScenario: "works when included file with ambient module changes",
265-
commandLineArgs: ["--w", "/a/b/foo.ts", "/a/b/bar.d.ts"],
265+
commandLineArgs: ["--w", "/users/username/projects/project/foo.ts", "/users/username/projects/project/bar.d.ts"],
266266
sys: () => {
267267
const root = {
268-
path: "/a/b/foo.ts",
268+
path: "/users/username/projects/project/foo.ts",
269269
content: `
270270
import * as fs from "fs";
271271
import * as u from "url";
272272
`
273273
};
274274

275275
const file = {
276-
path: "/a/b/bar.d.ts",
276+
path: "/users/username/projects/project/bar.d.ts",
277277
content: `
278278
declare module "url" {
279279
export interface Url {
@@ -282,12 +282,12 @@ declare module "url" {
282282
}
283283
`
284284
};
285-
return createWatchedSystem([root, file, libFile], { currentDirectory: "/a/b" });
285+
return createWatchedSystem([root, file, libFile], { currentDirectory: "/users/username/projects/project" });
286286
},
287287
edits: [
288288
{
289289
caption: "Add fs definition",
290-
edit: sys => sys.appendFile("/a/b/bar.d.ts", `
290+
edit: sys => sys.appendFile("/users/username/projects/project/bar.d.ts", `
291291
declare module "fs" {
292292
export interface Stats {
293293
isFile(): boolean;

src/testRunner/unittests/tsserver/resolutionCache.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -630,69 +630,69 @@ export const x = 10;`
630630
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem with project references", () => {
631631
it("sharing across references", () => {
632632
const host = createServerHost({
633-
"/src/projects/node_modules/moduleX/index.d.ts": "export const x = 10;",
634-
"/src/projects/common/tsconfig.json": JSON.stringify({
633+
"/users/username/projects/node_modules/moduleX/index.d.ts": "export const x = 10;",
634+
"/users/username/projects/common/tsconfig.json": JSON.stringify({
635635
compilerOptions: compilerOptionsToConfigJson({
636636
composite: true,
637637
traceResolution: true,
638638
}),
639639
}),
640-
"/src/projects/common/moduleA.ts": "export const a = 10;",
641-
"/src/projects/common/moduleB.ts": Utils.dedent`
640+
"/users/username/projects/common/moduleA.ts": "export const a = 10;",
641+
"/users/username/projects/common/moduleB.ts": Utils.dedent`
642642
import { x } from "moduleX";
643643
export const b = x;
644644
`,
645-
"/src/projects/app/tsconfig.json": JSON.stringify({
645+
"/users/username/projects/app/tsconfig.json": JSON.stringify({
646646
compilerOptions: compilerOptionsToConfigJson({
647647
composite: true,
648648
traceResolution: true,
649649
}),
650650
references: [{ path: "../common" }],
651651
}),
652-
"/src/projects/app/appA.ts": Utils.dedent`
652+
"/users/username/projects/app/appA.ts": Utils.dedent`
653653
import { x } from "moduleX";
654654
export const y = x;
655655
`,
656-
"/src/projects/app/appB.ts": Utils.dedent`
656+
"/users/username/projects/app/appB.ts": Utils.dedent`
657657
import { x } from "../common/moduleB";
658658
export const y = x;
659659
`,
660660
});
661661
const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) });
662-
openFilesForSession(["/src/projects/app/appB.ts"], session);
662+
openFilesForSession(["/users/username/projects/app/appB.ts"], session);
663663
baselineTsserverLogs("resolutionCache", "sharing across references", session);
664664
});
665665

666666
it("not sharing across references", () => {
667667
const host = createServerHost({
668-
"/src/projects/node_modules/moduleX/index.d.ts": "export const x = 10;",
669-
"/src/projects/common/tsconfig.json": JSON.stringify({
668+
"/users/username/projects/node_modules/moduleX/index.d.ts": "export const x = 10;",
669+
"/users/username/projects/common/tsconfig.json": JSON.stringify({
670670
compilerOptions: { composite: true, traceResolution: true },
671671
}),
672-
"/src/projects/common/moduleA.ts": "export const a = 10;",
673-
"/src/projects/common/moduleB.ts": Utils.dedent`
672+
"/users/username/projects/common/moduleA.ts": "export const a = 10;",
673+
"/users/username/projects/common/moduleB.ts": Utils.dedent`
674674
import { x } from "moduleX";
675675
export const b = x;
676676
`,
677-
"/src/projects/app/tsconfig.json": JSON.stringify({
677+
"/users/username/projects/app/tsconfig.json": JSON.stringify({
678678
compilerOptions: {
679679
composite: true,
680680
traceResolution: true,
681681
typeRoots: [], // Just some sample option that is different across the projects
682682
},
683683
references: [{ path: "../common" }],
684684
}),
685-
"/src/projects/app/appA.ts": Utils.dedent`
685+
"/users/username/projects/app/appA.ts": Utils.dedent`
686686
import { x } from "moduleX";
687687
export const y = x;
688688
`,
689-
"/src/projects/app/appB.ts": Utils.dedent`
689+
"/users/username/projects/app/appB.ts": Utils.dedent`
690690
import { x } from "../common/moduleB";
691691
export const y = x;
692692
`,
693693
});
694694
const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) });
695-
openFilesForSession(["/src/projects/app/appB.ts"], session);
695+
openFilesForSession(["/users/username/projects/app/appB.ts"], session);
696696
baselineTsserverLogs("resolutionCache", "not sharing across references", session);
697697
});
698698
});

0 commit comments

Comments
 (0)