mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 12:03:44 -05:00
Refactor and add wildcard scenario
This commit is contained in:
@@ -1341,6 +1341,26 @@ var x = 10;`
|
||||
}
|
||||
});
|
||||
|
||||
it("no project structure update on directory watch invoke on open file save", () => {
|
||||
const projectRootPath = "/users/username/projects/project";
|
||||
const fileA: File = {
|
||||
path: `${projectRootPath}/a.ts`,
|
||||
content: "export const a = 10;"
|
||||
};
|
||||
const config: File = {
|
||||
path: `${projectRootPath}/tsconfig.json`,
|
||||
content: "{}"
|
||||
};
|
||||
const files = [fileA, config];
|
||||
const host = createServerHost(files);
|
||||
const service = createProjectService(host);
|
||||
service.openClientFile(fileA.path);
|
||||
checkNumberOfProjects(service, { configuredProjects: 1 });
|
||||
|
||||
host.invokeWatchedDirectoriesRecursiveCallback(projectRootPath, "a.ts");
|
||||
host.checkTimeoutQueueLength(0);
|
||||
});
|
||||
|
||||
it("handles delayed directory watch invoke on file creation", () => {
|
||||
const projectRootPath = "/users/username/projects/project";
|
||||
const fileB: File = {
|
||||
|
||||
@@ -977,7 +977,7 @@ export const x = 10;`
|
||||
});
|
||||
|
||||
describe("avoid unnecessary invalidation", () => {
|
||||
it("failed lookup invalidation", () => {
|
||||
it("unnecessary lookup invalidation on save", () => {
|
||||
const expectedNonRelativeDirectories = [`${projectLocation}/node_modules`, `${projectLocation}/src`];
|
||||
const module1Name = "module1";
|
||||
const module2Name = "module2";
|
||||
@@ -999,6 +999,7 @@ export const x = 10;`
|
||||
verifyTrace(resolutionTrace, expectedTrace);
|
||||
verifyWatchesWithConfigFile(host, files, file1, expectedNonRelativeDirectories);
|
||||
|
||||
// invoke callback to simulate saving
|
||||
host.invokeWatchedDirectoriesRecursiveCallback(projectLocation + "/src", "file1.ts");
|
||||
host.checkTimeoutQueueLengthAndRun(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user