Refactor and add wildcard scenario

This commit is contained in:
Benjamin Lichtman
2019-05-31 11:24:54 -07:00
parent 6b92ccaffa
commit 7ac5fa783b
4 changed files with 34 additions and 6 deletions

View File

@@ -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 = {

View 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);
});