Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send configFileDiag event when presence of errors change on project.update #58120

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

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
Add test when file rename occurs and configFileDiag happens before pr…
…oject observes file rename
  • Loading branch information
sheetalkamat committed Apr 8, 2024
commit b36fdd62e18de010199473eddebd7fd52d966936
25 changes: 25 additions & 0 deletions src/testRunner/unittests/tsserver/projectErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
File,
Folder,
libFile,
TestServerHostOsFlavor,
} from "../helpers/virtualFileSystemWithWatch";

describe("unittests:: tsserver:: projectErrors::", () => {
Expand Down Expand Up @@ -808,3 +809,27 @@ describe("unittests:: tsserver:: projectErrors:: with npm install when", () => {
verifyNpmInstall(/*timeoutDuringPartialInstallation*/ false);
});
});

describe("unittests:: tsserver:: projectErrors:: with file rename on wsl2::", () => {
it("rename a file", () => {
const host = createServerHost({
"/home/username/project/src/a.ts": `export const a = 10;`,
"/home/username/project/src/b.ts": `export const b = 10;`,
"/home/username/project/tsconfig.json": jsonToReadableText({
compilerOptions: {
strictNullChecks: true,
},
include: ["src/**/*.ts"],
}),
[libFile.path]: libFile.content,
}, { osFlavor: TestServerHostOsFlavor.Linux });
const session = new TestSession(host);
openFilesForSession([{ file: "/home/username/project/src/a.ts", projectRootPath: "/home/username/project" }], session);
host.renameFile("/home/username/project/src/b.ts", "/home/username/project/src/c.ts");
openFilesForSession([{ file: "/home/username/project/src/c.ts", content: `export const b = 10;`, projectRootPath: "/home/username/project" }], session);
host.runQueuedTimeoutCallbacks(); // Updates the project that c.ts now exists on the disk and schedules one more update
host.runQueuedTimeoutCallbacks();
closeFilesForSession(["/home/username/project/src/c.ts"], session);
baselineTsserverLogs("projectErrors", "file rename on wsl2", session);
});
});
Loading