From 6224ddcc019cc368efae2286bd28a25d5e65184c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 4 Mar 2022 10:57:57 -0800 Subject: [PATCH] Test gets further than before I'm pretty sure I need to delete and re-number some of the rest though. --- .../tsserver/applyChangesToOpenFiles.ts | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index 46bf7b475b9..ec57420d706 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -5,7 +5,7 @@ namespace ts.projectSystem { applyChangesToOpen: (session: TestSession) => void; openFile1Again: (session: TestSession) => void; } - const configFile: protocol.FileSystemRequestArgs = { + const config: protocol.FileSystemRequestArgs = { file: "/a/b/tsconfig.json", fileContent: "{}" }; @@ -21,6 +21,37 @@ namespace ts.projectSystem { path: "/a/b/app.ts", content: "import { xyz } from './file3'; let x = xyz" }; + const file3File: File = { + path: "/a/b/file3.ts", + content: "export let xyz = 1;" + } + const configFile: File = { + path: "/a/b/tsconfig.json", + content: "{}" + }; + const file1: protocol.FileSystemRequestArgs = { + file: "/a/b/commonFile1.ts", + fileContent: "let x = 1" + }; + const file2: protocol.FileSystemRequestArgs = { + file: "/a/b/commonFile2.ts", + fileContent: "let y = 1" + }; + const libFileFile: protocol.FileSystemRequestArgs = { + file: "/a/lib/lib.d.ts", + fileContent: `/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; }` + }; + function fileContentWithComment(file: protocol.FileSystemRequestArgs | File) { return `// some copy right notice ${'content' in file ? file.content : file.fileContent}`; @@ -34,7 +65,7 @@ ${'content' in file ? file.content : file.fileContent}`; command: protocol.CommandTypes.UpdateFileSystem, arguments:{ fileSystem: 'memfs', - created: [app, file3, file1, file2, libFile, configFile], + created: [app, file3, file1, file2, libFileFile, config], deleted: [], // string[]; updated: [], //FileSystemRequestArgs[]; } @@ -44,11 +75,13 @@ ${'content' in file ? file.content : file.fileContent}`; arguments: { file: app.file } }); const service = session.getProjectService(); - const project = service.configuredProjects.get(configFile.file)!; + const project = service.configuredProjects.get(config.file)!; const vfs = (session as any).host.vfs assert.isDefined(vfs); assert.isDefined(project); verifyProjectVersion(project, 1); + // for some reason I have here ... (but I think is duped from above, but maybe if I delete this I need to lower the expected projectVersion throughout?) + // PROBABLY session.executeCommandSeq({ command: protocol.CommandTypes.Open, arguments: app