diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 254ec1c7985..63a3d6963d5 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -60,7 +60,7 @@ namespace vfs { private _dirStack: string[] | undefined; constructor(ignoreCase: boolean, options: FileSystemOptions = {}) { - const { time = ts.VirtualFS.timeIncrements, files, meta } = options; + const { time = ts.TestFSWithWatch.timeIncrements, files, meta } = options; this.ignoreCase = ignoreCase; this.stringComparer = this.ignoreCase ? vpath.compareCaseInsensitive : vpath.compareCaseSensitive; this._time = time; @@ -173,7 +173,7 @@ namespace vfs { this._time = value; } else if (!this.isReadonly) { - this._time += ts.VirtualFS.timeIncrements; + this._time += ts.TestFSWithWatch.timeIncrements; } return this._time; } diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index aa27564e535..9aeae657751 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1,5 +1,5 @@ -namespace ts.VirtualFS { - export const libFile: File = { +namespace ts.TestFSWithWatch { + export const libFile: VirtualFS.File = { path: "/a/lib/lib.d.ts", content: `/// interface Boolean {} @@ -27,23 +27,21 @@ interface Array { length: number; [n: number]: T; }` environmentVariables?: ESMap; runWithoutRecursiveWatches?: boolean; runWithFallbackPolling?: boolean; - // TODO: Not sure withSafeList is still needed - withSafeList?: boolean; inodeWatching?: boolean; } - export function createVirtualServerHost(params: VirtualServerHostCreationParameters): VirtualServerHost { - const host = new VirtualServerHost(params); + export function createVirtualServerHost(params: VirtualFS.VirtualServerHostCreationParameters): VirtualFS.VirtualServerHost { + const host = new VirtualFS.VirtualServerHost(params); // Just like sys, patch the host to use writeFile patchWriteFileEnsuringDirectory(host); return host; } - export function createWatchedSystem(fileOrFolderList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters): TestServerHost { + export function createWatchedSystem(fileOrFolderList: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters): TestServerHost { return new TestServerHost(fileOrFolderList, params); } - export function createServerHost(fileOrFolderList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters): TestServerHost { + export function createServerHost(fileOrFolderList: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters): TestServerHost { const host = new TestServerHost(fileOrFolderList, params); // Just like sys, patch the host to use writeFile patchWriteFileEnsuringDirectory(host); @@ -116,7 +114,7 @@ interface Array { length: number; [n: number]: T; }` serialize(baseline: string[]) { for (const id in this.map) { - baseline.push(`${id} at time ${this.map[id].time} in ${this.map[id].ms} ms: ${this.map[id].args[1]}`) + baseline.push(`${id} at time ${this.map[id].time} in ${this.map[id].ms} ms: ${this.map[id].args[1]}`); } } } @@ -213,7 +211,7 @@ interface Array { length: number; [n: number]: T; }` export const timeIncrements = 1000; - export class TestServerHost extends VirtualServerHost implements server.ServerHost { + export class TestServerHost extends VirtualFS.VirtualServerHost implements server.ServerHost { private readonly output: string[] = []; private time = timeIncrements; private timeoutCallbacks = new Callbacks(this); @@ -226,7 +224,7 @@ interface Array { length: number; [n: number]: T; }` private readonly inodes?: ESMap; constructor( - fileOrFolderOrSymLinkList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[], + fileOrFolderOrSymLinkList: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[], options: TestServerHostCreationParameters = {}) { super({ ...options, @@ -273,7 +271,7 @@ interface Array { length: number; [n: number]: T; }` this.time = time; } - private reloadFS(fileOrFolderOrSymLinkList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[]) { + private reloadFS(fileOrFolderOrSymLinkList: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[]) { Debug.assert(this.fs.size === 0); if (isArray(fileOrFolderOrSymLinkList)) { fileOrFolderOrSymLinkList.forEach(f => this.ensureFileOrFolder(!this.windowsStyleRoot ? @@ -300,7 +298,7 @@ interface Array { length: number; [n: number]: T; }` renameFile(fileName: string, newFileName: string) { const fullPath = getNormalizedAbsolutePath(fileName, this.currentDirectory); const path = this.toPath(fullPath); - const file = this.fs.get(path) as FsFile; + const file = this.fs.get(path) as VirtualFS.FsFile; Debug.assert(!!file); // Only remove the file @@ -313,14 +311,14 @@ interface Array { length: number; [n: number]: T; }` const basePath = getDirectoryPath(path); Debug.assert(basePath !== path); Debug.assert(basePath === getDirectoryPath(newPath)); - const baseFolder = this.fs.get(basePath) as FsFolder; + const baseFolder = this.fs.get(basePath) as VirtualFS.FsFolder; this.addFileOrFolderInFolder(baseFolder, newFile); } renameFolder(folderName: string, newFolderName: string) { const fullPath = getNormalizedAbsolutePath(folderName, this.currentDirectory); const path = this.toPath(fullPath); - const folder = this.fs.get(path) as FsFolder; + const folder = this.fs.get(path) as VirtualFS.FsFolder; Debug.assert(!!folder); // Only remove the folder @@ -333,14 +331,14 @@ interface Array { length: number; [n: number]: T; }` const basePath = getDirectoryPath(path); Debug.assert(basePath !== path); Debug.assert(basePath === getDirectoryPath(newPath)); - const baseFolder = this.fs.get(basePath) as FsFolder; + const baseFolder = this.fs.get(basePath) as VirtualFS.FsFolder; this.addFileOrFolderInFolder(baseFolder, newFolder); // Invoke watches for files in the folder as deleted (from old path) this.renameFolderEntries(folder, newFolder); } - private renameFolderEntries(oldFolder: FsFolder, newFolder: FsFolder) { + private renameFolderEntries(oldFolder: VirtualFS.FsFolder, newFolder: VirtualFS.FsFolder) { for (const entry of oldFolder.entries) { this.fs.delete(entry.path); this.invokeFileAndFsWatches(entry.fullPath, FileWatcherEventKind.Deleted); @@ -353,7 +351,7 @@ interface Array { length: number; [n: number]: T; }` this.fs.set(entry.path, entry); this.setInode(entry.path); this.invokeFileAndFsWatches(entry.fullPath, FileWatcherEventKind.Created); - if (isFsFolder(entry)) { + if (VirtualFS.isFsFolder(entry)) { this.renameFolderEntries(entry, entry); } } @@ -361,12 +359,12 @@ interface Array { length: number; [n: number]: T; }` deleteFolder(folderPath: string, recursive?: boolean) { const path = this.toFullPath(folderPath); - const currentEntry = this.fs.get(path) as FsFolder; - Debug.assert(isFsFolder(currentEntry)); + const currentEntry = this.fs.get(path) as VirtualFS.FsFolder; + Debug.assert(VirtualFS.isFsFolder(currentEntry)); if (recursive && currentEntry.entries.length) { const subEntries = currentEntry.entries.slice(); subEntries.forEach(fsEntry => { - if (isFsFolder(fsEntry)) { + if (VirtualFS.isFsFolder(fsEntry)) { this.deleteFolder(fsEntry.fullPath, recursive); } else { @@ -386,7 +384,7 @@ interface Array { length: number; [n: number]: T; }` const path = this.toFullPath(fileOrDirectory); // Error if the path does not exist if (this.inodeWatching && !this.inodes?.has(path)) throw new Error(); - const result = createWatcher( + const result = VirtualFS.createWatcher( recursive ? this.fsWatchesRecursive : this.fsWatches, path, { @@ -421,7 +419,7 @@ interface Array { length: number; [n: number]: T; }` } serializeTimeout(baseline: string[]) { - this.timeoutCallbacks.serialize(baseline) + this.timeoutCallbacks.serialize(baseline); } clearScreen(): void { @@ -465,11 +463,11 @@ interface Array { length: number; [n: number]: T; }` this.immediateCallbacks.unregister(timeoutId); } - prependFile(path: string, content: string, options?: Partial): void { + prependFile(path: string, content: string, options?: Partial): void { this.modifyFile(path, content + this.readFile(path), options); } - appendFile(path: string, content: string, options?: Partial): void { + appendFile(path: string, content: string, options?: Partial): void { this.modifyFile(path, this.readFile(path) + content, options); } @@ -512,12 +510,12 @@ interface Array { length: number; [n: number]: T; }` } } - export function snap(fshost: VirtualServerHost): ESMap { - const result = new Map(); + export function snap(fshost: VirtualFS.VirtualServerHost): ESMap { + const result = new Map(); fshost.fs.forEach((value, key) => { const cloneValue = clone(value); - if (isFsFolder(cloneValue)) { - cloneValue.entries = cloneValue.entries.map(clone) as SortedArray; + if (VirtualFS.isFsFolder(cloneValue)) { + cloneValue.entries = cloneValue.entries.map(clone) as SortedArray; } result.set(key, cloneValue); }); @@ -525,7 +523,7 @@ interface Array { length: number; [n: number]: T; }` return result; } - export function diff(fshost: VirtualServerHost, baseline: string[], base: ESMap = new Map()) { + export function diff(fshost: VirtualFS.VirtualServerHost, baseline: string[], base: ESMap = new Map()) { fshost.fs.forEach((newFsEntry, path) => { diffFsEntry(baseline, base.get(path), newFsEntry, fshost.getInode(path), fshost.writtenFiles); }); @@ -538,19 +536,19 @@ interface Array { length: number; [n: number]: T; }` baseline.push(""); } - function diffFsFile(baseline: string[], fsEntry: FsFile, newInode: number | undefined) { + function diffFsFile(baseline: string[], fsEntry: VirtualFS.FsFile, newInode: number | undefined) { baseline.push(`//// [${fsEntry.fullPath}]${inodeString(newInode)}\r\n${fsEntry.content}`, ""); } - function diffFsSymLink(baseline: string[], fsEntry: FsSymLink, newInode: number | undefined) { + function diffFsSymLink(baseline: string[], fsEntry: VirtualFS.FsSymLink, newInode: number | undefined) { baseline.push(`//// [${fsEntry.fullPath}] symlink(${fsEntry.symLink})${inodeString(newInode)}`); } function inodeString(inode: number | undefined) { return inode !== undefined ? ` Inode:: ${inode}` : ""; } - function diffFsEntry(baseline: string[], oldFsEntry: FSEntry | undefined, newFsEntry: FSEntry | undefined, newInode: number | undefined, writtenFiles: ESMap | undefined): void { + function diffFsEntry(baseline: string[], oldFsEntry: VirtualFS.FSEntry | undefined, newFsEntry: VirtualFS.FSEntry | undefined, newInode: number | undefined, writtenFiles: ESMap | undefined): void { const file = newFsEntry && newFsEntry.fullPath; - if (isFsFile(oldFsEntry)) { - if (isFsFile(newFsEntry)) { + if (VirtualFS.isFsFile(oldFsEntry)) { + if (VirtualFS.isFsFile(newFsEntry)) { if (oldFsEntry.content !== newFsEntry.content) { diffFsFile(baseline, newFsEntry, newInode); } @@ -568,13 +566,13 @@ interface Array { length: number; [n: number]: T; }` } else { baseline.push(`//// [${oldFsEntry.fullPath}] deleted`); - if (isFsSymLink(newFsEntry)) { + if (VirtualFS.isFsSymLink(newFsEntry)) { diffFsSymLink(baseline, newFsEntry, newInode); } } } - else if (isFsSymLink(oldFsEntry)) { - if (isFsSymLink(newFsEntry)) { + else if (VirtualFS.isFsSymLink(oldFsEntry)) { + if (VirtualFS.isFsSymLink(newFsEntry)) { if (oldFsEntry.symLink !== newFsEntry.symLink) { diffFsSymLink(baseline, newFsEntry, newInode); } @@ -592,15 +590,15 @@ interface Array { length: number; [n: number]: T; }` } else { baseline.push(`//// [${oldFsEntry.fullPath}] deleted symlink`); - if (isFsFile(newFsEntry)) { + if (VirtualFS.isFsFile(newFsEntry)) { diffFsFile(baseline, newFsEntry, newInode); } } } - else if (isFsFile(newFsEntry)) { + else if (VirtualFS.isFsFile(newFsEntry)) { diffFsFile(baseline, newFsEntry, newInode); } - else if (isFsSymLink(newFsEntry)) { + else if (VirtualFS.isFsSymLink(newFsEntry)) { diffFsSymLink(baseline, newFsEntry, newInode); } } @@ -631,7 +629,7 @@ interface Array { length: number; [n: number]: T; }` return `${tsbuildProjectsLocation}/${project}/${file}`; } - export function getTsBuildProjectFile(project: string, file: string): File { + export function getTsBuildProjectFile(project: string, file: string): VirtualFS.File { return { path: getTsBuildProjectFilePath(project, file), content: Harness.IO.readFile(`${Harness.IO.getWorkspaceRoot()}/tests/projects/${project}/${file}`)! diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index d9fe9793217..0b2db49d142 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -3756,21 +3756,26 @@ namespace ts.server { updateFileSystem(updatedFiles: protocol.FileSystemRequestArgs[] | undefined, deletedFiles?: string[]) { if (!this.fshost) { this.logger.msg("fshost not defined, skipping updateFileSystem", Msg.Err); + return; } if (updatedFiles) { - if (!this.fshost.ensureFileOrFolder) { - this.logger.msg(`fshost missing ensureFileOrFolder, skipping update of ${JSON.stringify(updatedFiles.map(({ file }) => file))}`, Msg.Err); + if (this.fshost.ensureFileOrFolder) { + for (const { file, fileContent } of updatedFiles) { + this.fshost.ensureFileOrFolder({ path: file, content: fileContent }); + } } - for (const { file, fileContent } of updatedFiles) { - this.fshost.ensureFileOrFolder({ path: file, content: fileContent }); + else { + this.logger.msg(`fshost missing ensureFileOrFolder, skipping update of ${JSON.stringify(updatedFiles.map(({ file }) => file))}`, Msg.Err); } } if (deletedFiles) { - if (!this.fshost.deleteFile) { - this.logger.msg(`fshost missing deleteFile, skipping delete of ${JSON.stringify(deletedFiles)}`, Msg.Err); + if (this.fshost.deleteFile) { + for (const file of deletedFiles) { + this.fshost.deleteFile(file, /*deleteEmptyParentFolders*/ true); + } } - for (const file of deletedFiles) { - this.fshost.deleteFile(file, /*deleteEmptyParentFolders*/ true); + else { + this.logger.msg(`fshost missing deleteFile, skipping delete of ${JSON.stringify(deletedFiles)}`, Msg.Err); } } } diff --git a/src/server/project.ts b/src/server/project.ts index 9fec0509a10..d7a52faef00 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -322,7 +322,7 @@ namespace ts.server { else if (host.trace) { this.trace = s => host.trace!(s); } - this.realpath = maybeBind(this.projectService.host, this.projectService.host.realpath); + this.realpath = maybeBind(host, host.realpath); // Use the current directory as resolution root only if the project created using current directory string this.resolutionCache = createResolutionCache( diff --git a/src/server/session.ts b/src/server/session.ts index a2481d9cb2b..ff25e772da4 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -809,7 +809,7 @@ namespace ts.server { }; this.errorCheck = new MultistepOperation(multistepOperationHost); const settings: ProjectServiceOptions = { - host: this.host, + host: opts.host, fshost: opts.fshost, logger: this.logger, cancellationToken: this.cancellationToken, diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 49209e632b3..587d737764a 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -19,10 +19,10 @@ { "path": "../executeCommandLine", "prepend": true }, { "path": "../services", "prepend": true }, { "path": "../jsTyping", "prepend": true }, + { "path": "../vfs", "prepend": true }, { "path": "../server", "prepend": true }, { "path": "../webServer", "prepend": true }, { "path": "../typingsInstallerCore", "prepend": true }, - { "path": "../vfs", "prepend": true }, { "path": "../deprecatedCompat", "prepend": true }, { "path": "../harness", "prepend": true }, { "path": "../loggedIO", "prepend": true } diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index 6e6020285bb..a70329a8db8 100644 --- a/src/testRunner/unittests/config/projectReferences.ts +++ b/src/testRunner/unittests/config/projectReferences.ts @@ -74,7 +74,7 @@ namespace ts { } } - const vfsys = new vfs.FileSystem(false, { files: { "/lib.d.ts": VirtualFS.libFile.content } }); + const vfsys = new vfs.FileSystem(false, { files: { "/lib.d.ts": TestFSWithWatch.libFile.content } }); files.forEach((v, k) => { vfsys.mkdirpSync(getDirectoryPath(k)); vfsys.writeFileSync(k, v); diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 568230b6c35..4338537f112 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -922,8 +922,8 @@ namespace ts { }); type File = VirtualFS.File; - import createTestSystem = VirtualFS.createWatchedSystem; - import libFile = VirtualFS.libFile; + import createTestSystem = TestFSWithWatch.createWatchedSystem; + import libFile = TestFSWithWatch.libFile; describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { function getWhetherProgramIsUptoDate( diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 31f8f250d70..2c10a8c1ecb 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -78,7 +78,7 @@ namespace ts { }; } - export const libContent = `${VirtualFS.libFile.content} + export const libContent = `${TestFSWithWatch.libFile.content} interface ReadonlyArray {} declare const console: { log(msg: any): void; };`; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 1467de309c4..1b082ed3c1b 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -13,7 +13,7 @@ namespace ts { function getTsBuildProjectFile(project: string, file: string): tscWatch.File { return { - path: VirtualFS.getTsBuildProjectFilePath(project, file), + path: TestFSWithWatch.getTsBuildProjectFilePath(project, file), content: projFs.readFileSync(`/src/${project}/${file}`, "utf8")! }; } @@ -250,8 +250,8 @@ namespace ts { const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); const testsIndex = getTsBuildProjectFile("tests", "index.ts"); const baseline: string[] = []; - let oldSnap: ReturnType | undefined; - const system = VirtualFS.changeToHostTrackingWrittenFiles( + let oldSnap: ReturnType | undefined; + const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite( tscWatch.createWatchedSystem([ coreConfig, coreIndex, coreDecl, coreAnotherModule, @@ -281,9 +281,9 @@ namespace ts { function baselineState() { system.serializeOutput(baseline); - VirtualFS.diff(system, baseline, oldSnap); + TestFSWithWatch.diff(system, baseline, oldSnap); system.writtenFiles.clear(); - oldSnap = VirtualFS.snap(system); + oldSnap = TestFSWithWatch.snap(system); } }); @@ -322,8 +322,8 @@ namespace ts { const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); const testsIndex = getTsBuildProjectFile("tests", "index.ts"); const baseline: string[] = []; - let oldSnap: ReturnType | undefined; - const system = VirtualFS.changeToHostTrackingWrittenFiles( + let oldSnap: ReturnType | undefined; + const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite( tscWatch.createWatchedSystem([ coreConfig, coreIndex, coreDecl, coreAnotherModule, @@ -366,9 +366,9 @@ namespace ts { function baselineState(heading: string) { baseline.push(heading); system.serializeOutput(baseline); - VirtualFS.diff(system, baseline, oldSnap); + TestFSWithWatch.diff(system, baseline, oldSnap); system.writtenFiles.clear(); - oldSnap = VirtualFS.snap(system); + oldSnap = TestFSWithWatch.snap(system); } }); }); diff --git a/src/testRunner/unittests/tsbuildWatch/demo.ts b/src/testRunner/unittests/tsbuildWatch/demo.ts index 918d485b025..ec27dba08a1 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -1,6 +1,6 @@ namespace ts.tscWatch { describe("unittests:: tsbuildWatch:: watchMode:: with demo project", () => { - const projectLocation = `${VirtualFS.tsbuildProjectsLocation}/demo`; + const projectLocation = `${TestFSWithWatch.tsbuildProjectsLocation}/demo`; let coreFiles: File[]; let animalFiles: File[]; let zooFiles: File[]; @@ -82,7 +82,7 @@ ${coreFiles[1].content}`), } function projectFile(fileName: string): File { - return VirtualFS.getTsBuildProjectFile("demo", fileName); + return TestFSWithWatch.getTsBuildProjectFile("demo", fileName); } }); } diff --git a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts index 231002a67e3..f372fae1939 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts @@ -3,7 +3,7 @@ namespace ts.tscWatch { function change(caption: string, content: string): TscWatchCompileChange { return { caption, - change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), + change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), // build project timeouts: checkSingleTimeoutQueueLengthAndRunAndVerifyNoTimeout, }; @@ -11,7 +11,7 @@ namespace ts.tscWatch { const noChange: TscWatchCompileChange = { caption: "No change", - change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), + change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), // build project timeouts: checkSingleTimeoutQueueLengthAndRunAndVerifyNoTimeout, }; @@ -22,10 +22,10 @@ namespace ts.tscWatch { sys: () => createWatchedSystem( [ ...["tsconfig.json", "shared/types/db.ts", "src/main.ts", "src/other.ts"] - .map(f => VirtualFS.getTsBuildProjectFile("noEmitOnError", f)), + .map(f => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)), { path: libFile.path, content: libContent } ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/noEmitOnError` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError` } ), changes: [ noChange, diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index d7f0d3c2796..7dae54440ba 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,5 +1,5 @@ namespace ts.tscWatch { - import projectsLocation = VirtualFS.tsbuildProjectsLocation; + import projectsLocation = TestFSWithWatch.tsbuildProjectsLocation; describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { const enum SubProject { core = "core", @@ -11,11 +11,11 @@ namespace ts.tscWatch { /** [tsconfig, index] | [tsconfig, index, anotherModule, someDecl] */ type SubProjectFiles = [tsconfig: ReadonlyFile, index: ReadonlyFile] | [tsconfig: ReadonlyFile, index: ReadonlyFile, anotherModule: ReadonlyFile, someDecl: ReadonlyFile]; function projectFilePath(subProject: SubProject, baseFileName: string) { - return `${VirtualFS.getTsBuildProjectFilePath("sample1", subProject)}/${baseFileName.toLowerCase()}`; + return `${TestFSWithWatch.getTsBuildProjectFilePath("sample1", subProject)}/${baseFileName.toLowerCase()}`; } function projectFile(subProject: SubProject, baseFileName: string): File { - return VirtualFS.getTsBuildProjectFile("sample1", `${subProject}/${baseFileName}`); + return TestFSWithWatch.getTsBuildProjectFile("sample1", `${subProject}/${baseFileName}`); } function subProjectFiles(subProject: SubProject, anotherModuleAndSomeDecl?: true): SubProjectFiles { diff --git a/src/testRunner/unittests/tsbuildWatch/reexport.ts b/src/testRunner/unittests/tsbuildWatch/reexport.ts index f250aa6e6ce..3e3af0e985d 100644 --- a/src/testRunner/unittests/tsbuildWatch/reexport.ts +++ b/src/testRunner/unittests/tsbuildWatch/reexport.ts @@ -11,15 +11,15 @@ namespace ts.tscWatch { "src/main/tsconfig.json", "src/main/index.ts", "src/pure/tsconfig.json", "src/pure/index.ts", "src/pure/session.ts" ] - .map(f => VirtualFS.getTsBuildProjectFile("reexport", f)), + .map(f => TestFSWithWatch.getTsBuildProjectFile("reexport", f)), { path: libFile.path, content: libContent } ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/reexport` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/reexport` } ), changes: [ { caption: "Introduce error", - change: sys => replaceFileText(sys, `${VirtualFS.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "// ", ""), + change: sys => replaceFileText(sys, `${TestFSWithWatch.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "// ", ""), timeouts: sys => { sys.checkTimeoutQueueLengthAndRun(1); // build src/pure sys.checkTimeoutQueueLengthAndRun(1); // build src/main and src @@ -28,7 +28,7 @@ namespace ts.tscWatch { }, { caption: "Fix error", - change: sys => replaceFileText(sys, `${VirtualFS.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "bar: ", "// bar: "), + change: sys => replaceFileText(sys, `${TestFSWithWatch.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "bar: ", "// bar: "), timeouts: sys => { sys.checkTimeoutQueueLengthAndRun(1); // build src/pure sys.checkTimeoutQueueLengthAndRun(1); // build src/main and src diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 11445a2c43d..c5e9e748deb 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -13,7 +13,7 @@ namespace ts.tscWatch { function verifyWatchFileOnMultipleProjects(singleWatchPerFile: boolean, environmentVariables?: ESMap) { it("watchFile on same file multiple times because file is part of multiple projects", () => { - const project = `${VirtualFS.tsbuildProjectsLocation}/myproject`; + const project = `${TestFSWithWatch.tsbuildProjectsLocation}/myproject`; let maxPkgs = 4; const configPath = `${project}/tsconfig.json`; const typing: File = { @@ -111,7 +111,7 @@ namespace ts.tscWatch { } ]; } - function writePkgReferences(system: VirtualFS.TestServerHost) { + function writePkgReferences(system: TestFSWithWatch.TestServerHost) { system.writeFile(configPath, JSON.stringify({ files: [], include: [], diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 1c3158c90f5..789c1d85d94 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -337,22 +337,22 @@ export class Data2 { function change(caption: string, content: string): TscWatchCompileChange { return { caption, - change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), + change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), // build project timeouts: checkSingleTimeoutQueueLengthAndRun }; } const noChange: TscWatchCompileChange = { caption: "No change", - change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), + change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), // build project timeouts: checkSingleTimeoutQueueLengthAndRun, }; verifyEmitAndErrorUpdates({ subScenario: "with noEmitOnError", - currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/noEmitOnError`, + currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError`, files: () => ["shared/types/db.ts", "src/main.ts", "src/other.ts", "tsconfig.json"] - .map(f => VirtualFS.getTsBuildProjectFile("noEmitOnError", f)).concat({ path: libFile.path, content: libContent }), + .map(f => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)).concat({ path: libFile.path, content: libContent }), changes: [ noChange, change("Fix Syntax error", `import { A } from "../shared/types/db"; diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 7ea388c15da..728324c1082 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -1,14 +1,14 @@ namespace ts.tscWatch { export const projects = `/user/username/projects`; export const projectRoot = `${projects}/myproject`; - export import WatchedSystem = VirtualFS.TestServerHost; + export import WatchedSystem = TestFSWithWatch.TestServerHost; export type File = VirtualFS.File; export type SymLink = VirtualFS.SymLink; - export import libFile = VirtualFS.libFile; - export import createWatchedSystem = VirtualFS.createWatchedSystem; - export import checkArray = VirtualFS.checkArray; - export import checkOutputContains = VirtualFS.checkOutputContains; - export import checkOutputDoesNotContain = VirtualFS.checkOutputDoesNotContain; + export import libFile = TestFSWithWatch.libFile; + export import createWatchedSystem = TestFSWithWatch.createWatchedSystem; + export import checkArray = TestFSWithWatch.checkArray; + export import checkOutputContains = TestFSWithWatch.checkOutputContains; + export import checkOutputDoesNotContain = TestFSWithWatch.checkOutputDoesNotContain; export const commonFile1: File = { path: "/a/b/commonFile1.ts", @@ -98,9 +98,9 @@ namespace ts.tscWatch { export type WatchOrSolution = void | SolutionBuilder | WatchOfConfigFile | WatchOfFilesAndCompilerOptions; export interface TscWatchCompileChange { caption: string; - change: (sys: VirtualFS.TestServerHostTrackingWrittenFiles) => void; + change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void; timeouts: ( - sys: VirtualFS.TestServerHostTrackingWrittenFiles, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, programs: readonly CommandLineProgram[], watchOrSolution: WatchOrSolution ) => void; @@ -125,7 +125,7 @@ namespace ts.tscWatch { timeouts: sys => sys.checkTimeoutQueueLength(0), }; - export type SystemSnap = ReturnType; + export type SystemSnap = ReturnType; function tscWatchCompile(input: TscWatchCompile) { it("tsc-watch:: Generates files matching the baseline", () => { const { sys, baseline, oldSnap } = createBaseline(input.sys()); @@ -160,7 +160,7 @@ namespace ts.tscWatch { export interface BaselineBase { baseline: string[]; - sys: VirtualFS.TestServerHostTrackingWrittenFiles; + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; oldSnap: SystemSnap; } @@ -171,12 +171,12 @@ namespace ts.tscWatch { const originalRead = system.readFile; const initialSys = fakes.patchHostForBuildInfoReadWrite(system); modifySystem?.(initialSys, originalRead); - const sys = VirtualFS.changeToHostTrackingWrittenFiles(initialSys); + const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles(initialSys); const baseline: string[] = []; baseline.push("Input::"); - VirtualFS.diff(sys, baseline); + TestFSWithWatch.diff(sys, baseline); const { cb, getPrograms } = commandLineCallbacks(sys); - return { sys, baseline, oldSnap: VirtualFS.snap(sys), cb, getPrograms }; + return { sys, baseline, oldSnap: TestFSWithWatch.snap(sys), cb, getPrograms }; } export function createSolutionBuilderWithWatchHostForBaseline(sys: WatchedSystem, cb: ExecuteCommandLineCallbacks) { @@ -234,16 +234,16 @@ namespace ts.tscWatch { } export function applyChange(sys: BaselineBase["sys"], baseline: BaselineBase["baseline"], change: TscWatchCompileChange["change"], caption?: TscWatchCompileChange["caption"]) { - const oldSnap = VirtualFS.snap(sys); + const oldSnap = TestFSWithWatch.snap(sys); baseline.push(`Change::${caption ? " " + caption : ""}`, ""); change(sys); baseline.push("Input::"); - VirtualFS.diff(sys, baseline, oldSnap); - return VirtualFS.snap(sys); + TestFSWithWatch.diff(sys, baseline, oldSnap); + return TestFSWithWatch.snap(sys); } export interface RunWatchBaseline extends BaselineBase, TscWatchCompileBase { - sys: VirtualFS.TestServerHostTrackingWrittenFiles; + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; getPrograms: () => readonly CommandLineProgram[]; watchOrSolution: WatchOrSolution; } @@ -298,7 +298,7 @@ namespace ts.tscWatch { const programs = baselinePrograms(baseline, getPrograms, oldPrograms, baselineDependencies); sys.serializeWatches(baseline); baseline.push(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}`, ""); - VirtualFS.diff(sys, baseline, oldSnap); + TestFSWithWatch.diff(sys, baseline, oldSnap); sys.writtenFiles.forEach((value, key) => { assert.equal(value, 1, `Expected to write file ${key} only once`); }); @@ -422,7 +422,7 @@ namespace ts.tscWatch { const originalReadFile = sys.readFile; const originalWrite = sys.write; const originalWriteFile = sys.writeFile; - const solutionBuilder = createSolutionBuilder(VirtualFS.changeToHostTrackingWrittenFiles( + const solutionBuilder = createSolutionBuilder(TestFSWithWatch.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite(sys) ), solutionRoots, originalRead); solutionBuilder.build(); @@ -432,7 +432,7 @@ namespace ts.tscWatch { return sys; } - export function createSystemWithSolutionBuild(solutionRoots: readonly string[], files: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[], params?: VirtualFS.TestServerHostCreationParameters) { + export function createSystemWithSolutionBuild(solutionRoots: readonly string[], files: VirtualFS.FileOrFolderOrSymLinkMap | readonly VirtualFS.FileOrFolderOrSymLink[], params?: TestFSWithWatch.TestServerHostCreationParameters) { return solutionBuildWithBaseline(createWatchedSystem(files, params), solutionRoots); } } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index ccdc99ff7d5..1745ffd684a 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -545,7 +545,7 @@ export class A { }); const {cb: cb2, getPrograms: getPrograms2 } = commandLineCallbacks(sys); - const oldSnap2 = VirtualFS.snap(sys); + const oldSnap2 = TestFSWithWatch.snap(sys); baseline.push("createing separate watcher"); createWatchProgram(createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ rootFiles:[file1.path], diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 0facf1928cb..d4e94e19710 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -7,23 +7,23 @@ namespace ts.tscWatch { ["tests"], [ libFile, - VirtualFS.getTsBuildProjectFile("sample1", "core/tsconfig.json"), - VirtualFS.getTsBuildProjectFile("sample1", "core/index.ts"), - VirtualFS.getTsBuildProjectFile("sample1", "core/anotherModule.ts"), - VirtualFS.getTsBuildProjectFile("sample1", "core/some_decl.d.ts"), - VirtualFS.getTsBuildProjectFile("sample1", "logic/tsconfig.json"), - VirtualFS.getTsBuildProjectFile("sample1", "logic/index.ts"), - VirtualFS.getTsBuildProjectFile("sample1", "tests/tsconfig.json"), - VirtualFS.getTsBuildProjectFile("sample1", "tests/index.ts"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "core/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "core/index.ts"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "core/anotherModule.ts"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "core/some_decl.d.ts"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "logic/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "logic/index.ts"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "tests/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFile("sample1", "tests/index.ts"), ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/sample1` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/sample1` } ), commandLineArgs: ["-w", "-p", "tests"], changes: [ { caption: "local edit in logic ts, and build logic", change: sys => { - sys.appendFile(VirtualFS.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `function foo() { }`); + sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `function foo() { }`); const solutionBuilder = createSolutionBuilder(sys, ["logic"]); solutionBuilder.build(); }, @@ -34,7 +34,7 @@ namespace ts.tscWatch { { caption: "non local edit in logic ts, and build logic", change: sys => { - sys.appendFile(VirtualFS.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `export function gfoo() { }`); + sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `export function gfoo() { }`); const solutionBuilder = createSolutionBuilder(sys, ["logic"]); solutionBuilder.build(); }, @@ -43,7 +43,7 @@ namespace ts.tscWatch { { caption: "change in project reference config file builds correctly", change: sys => { - sys.writeFile(VirtualFS.getTsBuildProjectFilePath("sample1", "logic/tsconfig.json"), JSON.stringify({ + sys.writeFile(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true, declaration: true, declarationDir: "decls" }, references: [{ path: "../core" }] })); @@ -69,22 +69,22 @@ namespace ts.tscWatch { ["tsconfig.c.json"], [ libFile, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "a.ts"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "b.ts"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "c.ts"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "a.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "b.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "c.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "tsconfig.c.json"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), `export function gfoo() { }`); + sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), `export function gfoo() { }`); const solutionBuilder = createSolutionBuilder(sys, ["tsconfig.b.json"]); solutionBuilder.build(); }, @@ -94,46 +94,46 @@ namespace ts.tscWatch { caption: "edit on config file", change: sys => { sys.ensureFileOrFolder({ - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] }); + changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert deleting referenced config file", - change: sys => sys.ensureFileOrFolder(VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")), + change: sys => sys.ensureFileOrFolder(TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting transitively referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert deleting transitively referenced config file", - change: sys => sys.ensureFileOrFolder(VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")), + change: sys => sys.ensureFileOrFolder(TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, ], @@ -147,25 +147,25 @@ namespace ts.tscWatch { ["tsconfig.c.json"], [ libFile, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), content: JSON.stringify({ compilerOptions: { composite: true, moduleResolution: "classic" }, files: ["b.ts"], references: [{ path: "tsconfig.a.json" }] }) }, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "a.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "a.ts"), { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), content: `import {A} from "a";export const b = new A();` }, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "c.ts"), - VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "c.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "tsconfig.c.json"], changes: emptyArray, @@ -180,14 +180,14 @@ namespace ts.tscWatch { [ libFile, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true }, files: ["index.ts"] }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, files: ["index.ts"], @@ -195,7 +195,7 @@ namespace ts.tscWatch { }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, files: ["index.ts"], @@ -203,31 +203,31 @@ namespace ts.tscWatch { }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), content: `export class A {}`, }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), content: `import {A} from '@ref/a'; export const b = new A();`, }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), content: `import {b} from '../b'; import {X} from "@ref/a"; b; X;`, }, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "c"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); + sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); const solutionBuilder = createSolutionBuilder(sys, ["b"]); solutionBuilder.build(); }, @@ -237,37 +237,37 @@ X;`, caption: "edit on config file", change: sys => { sys.ensureFileOrFolder({ - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); + changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting referenced config file", change: sys => sys.writeFile( - VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, files: ["index.ts"], @@ -278,13 +278,13 @@ X;`, }, { caption: "deleting transitively referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting transitively referenced config file", change: sys => sys.writeFile( - VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true }, files: ["index.ts"] @@ -304,49 +304,49 @@ X;`, [ libFile, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true } }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, references: [{ path: `../a` }] }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, references: [{ path: `../b` }] }), }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), content: `export class A {}`, }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), content: `import {A} from '@ref/a'; export const b = new A();`, }, { - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), content: `import {b} from '../b'; import {X} from "@ref/a"; b; X;`, }, - VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "c"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); + sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); const solutionBuilder = createSolutionBuilder(sys, ["b"]); solutionBuilder.build(); }, @@ -356,37 +356,37 @@ X;`, caption: "edit on config file", change: sys => { sys.ensureFileOrFolder({ - path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); + changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting referenced config file", change: sys => sys.writeFile( - VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, references: [{ path: `../a` }] @@ -396,13 +396,13 @@ X;`, }, { caption: "deleting transitively referenced config file", - change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), + change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting transitively referenced config file", change: sys => sys.writeFile( - VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true } }), ), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 5e7fff43851..7bacdbbd5b2 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -1,5 +1,5 @@ namespace ts.tscWatch { - import getFileFromProject = VirtualFS.getTsBuildProjectFile; + import getFileFromProject = TestFSWithWatch.getTsBuildProjectFile; describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedirect", () => { interface VerifyWatchInput { files: readonly VirtualFS.FileOrFolderOrSymLink[]; diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index f0b1cbc9420..b90ee3f9d67 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -204,13 +204,13 @@ namespace ts.tscWatch { function createWatch( baseline: string[], config: File, - sys: VirtualFS.TestServerHostTrackingWrittenFiles, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, createProgram: CreateProgram, optionsToExtend?: CompilerOptions, ) { const { cb, getPrograms } = commandLineCallbacks(sys); baseline.push(`tsc --w${optionsToExtend?.noEmit ? " --noEmit" : ""}`); - const oldSnap = VirtualFS.snap(sys); + const oldSnap = TestFSWithWatch.snap(sys); const host = createWatchCompilerHostOfConfigFileForBaseline({ configFileName: config.path, optionsToExtend, @@ -246,9 +246,9 @@ namespace ts.tscWatch { function applyChangeForBuilderTest( baseline: string[], emitBaseline: string[], - sys: VirtualFS.TestServerHostTrackingWrittenFiles, - emitSys: VirtualFS.TestServerHostTrackingWrittenFiles, - change: (sys: VirtualFS.TestServerHostTrackingWrittenFiles) => void, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void, caption: string ) { // Change file @@ -260,8 +260,8 @@ namespace ts.tscWatch { baseline: string[], emitBaseline: string[], config: File, - sys: VirtualFS.TestServerHostTrackingWrittenFiles, - emitSys: VirtualFS.TestServerHostTrackingWrittenFiles, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, createProgram: CreateProgram, optionsToExtend?: CompilerOptions) { createWatch(baseline, config, sys, createProgram, optionsToExtend); @@ -385,7 +385,7 @@ namespace ts.tscWatch { applyChange(sys, baseline, sys => sys.writeFile(mainFile.path, "export const x = 10;"), "Fix error"); const { cb, getPrograms } = commandLineCallbacks(sys); - const oldSnap = VirtualFS.snap(sys); + const oldSnap = TestFSWithWatch.snap(sys); const reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true); const reportWatchStatus = createWatchStatusReporter(sys, /*pretty*/ true); const host = createWatchCompilerHostOfConfigFile({ diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 8c8c08221cc..3ce728e0963 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -3,13 +3,13 @@ namespace ts.projectSystem { export import protocol = server.protocol; export import CommandNames = server.CommandNames; - export import TestServerHost = VirtualFS.TestServerHost; + export import TestServerHost = TestFSWithWatch.TestServerHost; export type File = VirtualFS.File; export type SymLink = VirtualFS.SymLink; export type Folder = VirtualFS.Folder; - export import createServerHost = VirtualFS.createServerHost; - export import checkArray = VirtualFS.checkArray; - export import libFile = VirtualFS.libFile; + export import createServerHost = TestFSWithWatch.createServerHost; + export import checkArray = TestFSWithWatch.checkArray; + export import libFile = TestFSWithWatch.libFile; export import commonFile1 = tscWatch.commonFile1; export import commonFile2 = tscWatch.commonFile2; diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index e2faf34f30a..dcdb08a0f08 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -110,7 +110,7 @@ ${appendDts}` describe("when dependency project is not open", () => { describe("Of usageTs", () => { it("with initial file open, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -146,7 +146,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with initial file open, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -182,7 +182,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -225,7 +225,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -268,7 +268,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -322,7 +322,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -376,7 +376,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -419,7 +419,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -462,7 +462,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -516,7 +516,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -573,7 +573,7 @@ ${appendDts}` describe("Of dependencyTs in usage project", () => { it("with initial file open, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -604,7 +604,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with initial file open, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -635,7 +635,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -673,7 +673,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -711,7 +711,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -760,7 +760,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -809,7 +809,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -847,7 +847,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -885,7 +885,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -934,7 +934,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -988,7 +988,7 @@ ${appendDts}` describe("when the depedency file is open", () => { describe("Of usageTs", () => { it("with initial file open, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1024,7 +1024,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with initial file open, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1060,7 +1060,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1114,7 +1114,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1168,7 +1168,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1222,7 +1222,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1276,7 +1276,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1330,7 +1330,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1384,7 +1384,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1438,7 +1438,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1495,7 +1495,7 @@ ${appendDts}` describe("Of dependencyTs in usage project", () => { it("with initial file open, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1526,7 +1526,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1575,7 +1575,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with local change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1624,7 +1624,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1673,7 +1673,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, noEmitOutput(), "Emit output"); }); it("with change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1725,7 +1725,7 @@ ${appendDts}` describe("Of dependencyTs", () => { it("with initial file open, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1762,7 +1762,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with initial file open, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1798,7 +1798,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1853,7 +1853,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1907,7 +1907,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -1962,7 +1962,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with local change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -2016,7 +2016,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -2071,7 +2071,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to dependency, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -2125,7 +2125,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, without specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -2180,7 +2180,7 @@ ${appendDts}` assert.deepEqual(actualEmitOutput, expectedEmitOutput(expectedFiles), "Emit output"); }); it("with change to usage, with specifying project file", () => { - const host = VirtualFS.changeToHostTrackingWrittenFiles( + const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 82c96f3efb0..68ba0ba2a4e 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -10,8 +10,8 @@ namespace ts.projectSystem { describe("with container project", () => { function getProjectFiles(project: string): [File, File] { return [ - VirtualFS.getTsBuildProjectFile(project, "tsconfig.json"), - VirtualFS.getTsBuildProjectFile(project, "index.ts"), + TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json"), + TestFSWithWatch.getTsBuildProjectFile(project, "index.ts"), ]; } @@ -19,7 +19,7 @@ namespace ts.projectSystem { const containerLib = getProjectFiles("container/lib"); const containerExec = getProjectFiles("container/exec"); const containerCompositeExec = getProjectFiles("container/compositeExec"); - const containerConfig = VirtualFS.getTsBuildProjectFile(project, "tsconfig.json"); + const containerConfig = TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json"); const files = [libFile, ...containerLib, ...containerExec, ...containerCompositeExec, containerConfig]; it("does not error on container only project", () => { @@ -29,7 +29,7 @@ namespace ts.projectSystem { const session = createSession(host, { logger: createLoggerWithInMemoryLogs() }); const service = session.getProjectService(); service.openExternalProjects([{ - projectFileName: VirtualFS.getTsBuildProjectFilePath(project, project), + projectFileName: TestFSWithWatch.getTsBuildProjectFilePath(project, project), rootFiles: files.map(f => ({ fileName: f.path })), options: {} }]); diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index c611ad5547f..2cf3cacdb30 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -1,14 +1,14 @@ namespace ts.projectSystem { describe("unittests:: tsserver:: projects with references: invoking when references are already built", () => { it("on sample project", () => { - const coreConfig = VirtualFS.getTsBuildProjectFile("sample1", "core/tsconfig.json"); - const coreIndex = VirtualFS.getTsBuildProjectFile("sample1", "core/index.ts"); - const coreAnotherModule = VirtualFS.getTsBuildProjectFile("sample1", "core/anotherModule.ts"); - const coreSomeDecl = VirtualFS.getTsBuildProjectFile("sample1", "core/some_decl.d.ts"); - const logicConfig = VirtualFS.getTsBuildProjectFile("sample1", "logic/tsconfig.json"); - const logicIndex = VirtualFS.getTsBuildProjectFile("sample1", "logic/index.ts"); - const testsConfig = VirtualFS.getTsBuildProjectFile("sample1", "tests/tsconfig.json"); - const testsIndex = VirtualFS.getTsBuildProjectFile("sample1", "tests/index.ts"); + const coreConfig = TestFSWithWatch.getTsBuildProjectFile("sample1", "core/tsconfig.json"); + const coreIndex = TestFSWithWatch.getTsBuildProjectFile("sample1", "core/index.ts"); + const coreAnotherModule = TestFSWithWatch.getTsBuildProjectFile("sample1", "core/anotherModule.ts"); + const coreSomeDecl = TestFSWithWatch.getTsBuildProjectFile("sample1", "core/some_decl.d.ts"); + const logicConfig = TestFSWithWatch.getTsBuildProjectFile("sample1", "logic/tsconfig.json"); + const logicIndex = TestFSWithWatch.getTsBuildProjectFile("sample1", "logic/index.ts"); + const testsConfig = TestFSWithWatch.getTsBuildProjectFile("sample1", "tests/tsconfig.json"); + const testsIndex = TestFSWithWatch.getTsBuildProjectFile("sample1", "tests/index.ts"); const host = createServerHost([libFile, coreConfig, coreIndex, coreAnotherModule, coreSomeDecl, logicConfig, logicIndex, testsConfig, testsIndex]); const logger = createLoggerWithInMemoryLogs(); const service = createProjectService(host, { logger }); diff --git a/src/testRunner/unittests/tsserver/updateFileSystem.ts b/src/testRunner/unittests/tsserver/updateFileSystem.ts index cf473b95594..e3ca8752f99 100644 --- a/src/testRunner/unittests/tsserver/updateFileSystem.ts +++ b/src/testRunner/unittests/tsserver/updateFileSystem.ts @@ -34,8 +34,8 @@ ${file.fileContent}`; subScenario: string, requests: [string, ((host: TestServerHost, fshost: VirtualFS.VirtualServerHost) => void) | Partial][], ) { - const host = VirtualFS.createServerHost({ executingFilePath: "/host/tsc.js" }); - const fshost = VirtualFS.createVirtualServerHost({ executingFilePath: "/fshost/tsc.js" }); + const host = TestFSWithWatch.createServerHost({ executingFilePath: "/host/tsc.js" }); + const fshost = TestFSWithWatch.createVirtualServerHost({ executingFilePath: "/fshost/tsc.js" }); const session = createSession(host, { fshost, logger: createLoggerWithInMemoryLogs(), canUseEvents: true }); const history: string[] = []; VirtualFS.createWatcher(fshost.fsWatches, "/host/b/app.ts" as Path, { @@ -46,8 +46,8 @@ ${file.fileContent}`; inode: undefined, }); - let prev = VirtualFS.snap(fshost); - let prev2 = VirtualFS.snap(host); + let prev = TestFSWithWatch.snap(fshost); + let prev2 = TestFSWithWatch.snap(host); for (const [name, request] of requests) { if (typeof request === "function") { request(host, fshost); @@ -57,16 +57,16 @@ ${file.fileContent}`; } history.push(""); history.push("#### " + name); - VirtualFS.diff(fshost, history, prev); - prev = VirtualFS.snap(fshost); - VirtualFS.diff(host, history, prev2); - prev2 = VirtualFS.snap(host); - host.serializeTimeout(history) + TestFSWithWatch.diff(fshost, history, prev); + prev = TestFSWithWatch.snap(fshost); + TestFSWithWatch.diff(host, history, prev2); + prev2 = TestFSWithWatch.snap(host); + host.serializeTimeout(history); } - history.push("### fshost watches") - fshost.serializeWatches(history) - history.push("### host watches") - host.serializeWatches(history) + history.push("### fshost watches"); + fshost.serializeWatches(history); + history.push("### host watches"); + host.serializeWatches(history); Harness.Baseline.runBaseline(`tsserver/${scenario}/${subScenario.split(" ").join("-")}.txt`, history.join("\r\n")); baselineTsserverLogs(scenario, subScenario, session); } diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index e01e2a4721c..70ddb962bc4 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -41,7 +41,7 @@ namespace ts.projectSystem { let fshost: VirtualFS.VirtualServerHost | undefined; if (isVfs) { serverMode = LanguageServiceMode.Semantic; - fshost = VirtualFS.createVirtualServerHost({ executingFilePath: "/a/lib/tsc.js" }); + fshost = TestFSWithWatch.createVirtualServerHost({ executingFilePath: "/a/lib/tsc.js" }); fshost.ensureFileOrFolder(libFile); } const logger = logLevel !== undefined ? new server.MainProcessLogger(logLevel, webHost) : nullLogger(); diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index c995aa5ed00..86010906684 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -58,7 +58,7 @@ namespace ts.server { console.warn = (...args) => logger.msg(args.length === 1 ? args[0] : args.join(", "), Msg.Err); console.error = (...args) => logger.msg(args.length === 1 ? args[0] : args.join(", "), Msg.Err); - const fshost = vfs ? new VirtualFS.VirtualServerHost({ + const fshost = vfs ? new TestFSWithWatch.VirtualServerHost({ useCaseSensitiveFileNames: sys.useCaseSensitiveFileNames, executingFilePath: directorySeparator, // Use same executingFilePath as webserver newLine: sys.newLine, diff --git a/src/tsserver/tsconfig.json b/src/tsserver/tsconfig.json index 9ec2446de8f..4c7ac00e223 100644 --- a/src/tsserver/tsconfig.json +++ b/src/tsserver/tsconfig.json @@ -16,9 +16,9 @@ { "path": "../compiler", "prepend": true }, { "path": "../services", "prepend": true }, { "path": "../jsTyping", "prepend": true }, + { "path": "../vfs", "prepend": true }, { "path": "../server", "prepend": true }, { "path": "../webServer", "prepend": true }, - { "path": "../vfs", "prepend": true }, { "path": "../deprecatedCompat", "prepend": true } ] } diff --git a/src/webServer/tsconfig.json b/src/webServer/tsconfig.json index 414de0ede60..9d0e1297f58 100644 --- a/src/webServer/tsconfig.json +++ b/src/webServer/tsconfig.json @@ -12,7 +12,6 @@ { "path": "../compiler" }, { "path": "../jsTyping" }, { "path": "../services" }, - { "path": "../vfs" }, { "path": "../server" } ], "files": [