diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 584a8ba6b21..0c1789aece4 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1,4 +1,4 @@ -namespace ts.TestFSWithWatch { +namespace ts.VirtualFS { export const libFile: File = { path: "/a/lib/lib.d.ts", content: `/// diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 7c07391237a..72719fe465a 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -3702,7 +3702,7 @@ namespace ts.server { /* @internal */ updateFileSystem(updatedFiles: protocol.FileSystemRequestArgs[] | undefined, deletedFiles?: string[]) { Debug.assert(this.fshost); - const fs = this.fshost as TestFSWithWatch.VirtualServerHost; + const fs = this.fshost as VirtualFS.VirtualServerHost; if (updatedFiles) { for (const { file, fileContent } of updatedFiles) { if (fs.fileExists(file)) { diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index a70329a8db8..6e6020285bb 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": TestFSWithWatch.libFile.content } }); + const vfsys = new vfs.FileSystem(false, { files: { "/lib.d.ts": VirtualFS.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 3e9e5f23134..568230b6c35 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -921,9 +921,9 @@ namespace ts { }); }); - type File = TestFSWithWatch.File; - import createTestSystem = TestFSWithWatch.createWatchedSystem; - import libFile = TestFSWithWatch.libFile; + type File = VirtualFS.File; + import createTestSystem = VirtualFS.createWatchedSystem; + import libFile = VirtualFS.libFile; describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { function getWhetherProgramIsUptoDate( diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index a8bd6e6d520..ce09ce73758 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -1,5 +1,5 @@ namespace ts { - const libFile: TestFSWithWatch.File = { + const libFile: VirtualFS.File = { path: "/a/lib/lib.d.ts", content: `/// interface Boolean {} @@ -262,7 +262,7 @@ interface String { charAt: any; } interface Array {}` }; - const moduleFile: TestFSWithWatch.File = { + const moduleFile: VirtualFS.File = { path: "/module.ts", content: `export function fn(res: any): any { @@ -393,7 +393,7 @@ interface Array {}` } } - function makeLanguageService(file: TestFSWithWatch.File, includeLib?: boolean, includeModule?: boolean) { + function makeLanguageService(file: VirtualFS.File, includeLib?: boolean, includeModule?: boolean) { const files = [file]; if (includeLib) { files.push(libFile); // libFile is expensive to parse repeatedly - only test when required diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index c3f5f019541..99e0ad754ff 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -144,7 +144,7 @@ export function Component(x: Config): any;` describe("detects program upto date when new file is added to the referenced project", () => { function setup(useSourceOfProjectReferenceRedirect: (() => boolean) | undefined) { - const config1: TestFSWithWatch.File = { + const config1: VirtualFS.File = { path: `${tscWatch.projectRoot}/projects/project1/tsconfig.json`, content: JSON.stringify({ compilerOptions: { @@ -154,15 +154,15 @@ export function Component(x: Config): any;` exclude: ["temp"] }) }; - const class1: TestFSWithWatch.File = { + const class1: VirtualFS.File = { path: `${tscWatch.projectRoot}/projects/project1/class1.ts`, content: `class class1 {}` }; - const class1Dts: TestFSWithWatch.File = { + const class1Dts: VirtualFS.File = { path: `${tscWatch.projectRoot}/projects/project1/class1.d.ts`, content: `declare class class1 {}` }; - const config2: TestFSWithWatch.File = { + const config2: VirtualFS.File = { path: `${tscWatch.projectRoot}/projects/project2/tsconfig.json`, content: JSON.stringify({ compilerOptions: { @@ -174,7 +174,7 @@ export function Component(x: Config): any;` ] }) }; - const class2: TestFSWithWatch.File = { + const class2: VirtualFS.File = { path: `${tscWatch.projectRoot}/projects/project2/class2.ts`, content: `class class2 {}` }; diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 4ddd1b608d0..140ed1c72e9 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -1002,15 +1002,15 @@ export * from "lib"; libFile); }); - function testOrganizeExports(testName: string, testFile: TestFSWithWatch.File, ...otherFiles: TestFSWithWatch.File[]) { + function testOrganizeExports(testName: string, testFile: VirtualFS.File, ...otherFiles: VirtualFS.File[]) { testOrganizeImports(`${testName}.exports`, /*skipDestructiveCodeActions*/ true, testFile, ...otherFiles); } - function testOrganizeImports(testName: string, skipDestructiveCodeActions: boolean, testFile: TestFSWithWatch.File, ...otherFiles: TestFSWithWatch.File[]) { + function testOrganizeImports(testName: string, skipDestructiveCodeActions: boolean, testFile: VirtualFS.File, ...otherFiles: VirtualFS.File[]) { it(testName, () => runBaseline(`organizeImports/${testName}.ts`, skipDestructiveCodeActions, testFile, ...otherFiles)); } - function runBaseline(baselinePath: string, skipDestructiveCodeActions: boolean, testFile: TestFSWithWatch.File, ...otherFiles: TestFSWithWatch.File[]) { + function runBaseline(baselinePath: string, skipDestructiveCodeActions: boolean, testFile: VirtualFS.File, ...otherFiles: VirtualFS.File[]) { const { path: testPath, content: testContent } = testFile; const languageService = makeLanguageService(testFile, ...otherFiles); const changes = languageService.organizeImports({ skipDestructiveCodeActions, type: "file", fileName: testPath }, testFormatSettings, emptyOptions); @@ -1026,7 +1026,7 @@ export * from "lib"; ].join(newLineCharacter)); } - function makeLanguageService(...files: TestFSWithWatch.File[]) { + function makeLanguageService(...files: VirtualFS.File[]) { const host = projectSystem.createServerHost(files); const projectService = projectSystem.createProjectService(host, { useSingleInferredProject: true }); projectService.setCompilerOptionsForInferredProjects({ jsx: files.some(f => f.path.endsWith("x")) ? JsxEmit.React : JsxEmit.None }); diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index fdc3b3e0648..1214adf4800 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -98,7 +98,7 @@ namespace ts { } } - export const libContent = `${TestFSWithWatch.libFile.content} + export const libContent = `${VirtualFS.libFile.content} interface ReadonlyArray {} declare const console: { log(msg: any): void; };`; @@ -447,7 +447,7 @@ interface Symbol { if (!incremental) return; const incrementalMap = new Map(getEntries(incremental)); const cleanMap = new Map(getEntries(clean!)); - assert.equal(incrementalMap.size, cleanMap.size, `Incremental and clean size of map should match:: ${message}, Incremental keys: ${arrayFrom(incrementalMap.keys())} Clean: ${arrayFrom(cleanMap.keys())}${TestFSWithWatch.getDiffInKeys(incrementalMap, arrayFrom(cleanMap.keys()))}`); + assert.equal(incrementalMap.size, cleanMap.size, `Incremental and clean size of map should match:: ${message}, Incremental keys: ${arrayFrom(incrementalMap.keys())} Clean: ${arrayFrom(cleanMap.keys())}${VirtualFS.getDiffInKeys(incrementalMap, arrayFrom(cleanMap.keys()))}`); cleanMap.forEach((cleanValue, key) => { assert.isTrue(incrementalMap.has(key), `Expected to contain ${key} in incremental map:: ${message}, Incremental keys: ${arrayFrom(incrementalMap.keys())}`); verifyValue(key, incrementalMap.get(key)!, cleanValue); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index b3b51994b6d..122ff88b06a 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: TestFSWithWatch.getTsBuildProjectFilePath(project, file), + path: VirtualFS.getTsBuildProjectFilePath(project, file), content: projFs.readFileSync(`/src/${project}/${file}`, "utf8")! }; } @@ -233,8 +233,8 @@ namespace ts { const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); const testsIndex = getTsBuildProjectFile("tests", "index.ts"); const baseline: string[] = []; - let oldSnap: ReturnType | undefined; - const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( + let oldSnap: ReturnType | undefined; + const system = VirtualFS.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite( tscWatch.createWatchedSystem([ coreConfig, coreIndex, coreDecl, coreAnotherModule, @@ -304,8 +304,8 @@ namespace ts { const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); const testsIndex = getTsBuildProjectFile("tests", "index.ts"); const baseline: string[] = []; - let oldSnap: ReturnType | undefined; - const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( + let oldSnap: ReturnType | undefined; + const system = VirtualFS.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite( tscWatch.createWatchedSystem([ coreConfig, coreIndex, coreDecl, coreAnotherModule, diff --git a/src/testRunner/unittests/tsbuildWatch/demo.ts b/src/testRunner/unittests/tsbuildWatch/demo.ts index a648f084cd0..0c1ce82f4d3 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 = `${TestFSWithWatch.tsbuildProjectsLocation}/demo`; + const projectLocation = `${VirtualFS.tsbuildProjectsLocation}/demo`; let coreFiles: File[]; let animalFiles: File[]; let zooFiles: File[]; @@ -84,7 +84,7 @@ ${coreFiles[1].content}`), } function projectFile(fileName: string): File { - return TestFSWithWatch.getTsBuildProjectFile("demo", fileName); + return VirtualFS.getTsBuildProjectFile("demo", fileName); } }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts index 34ae0e8bcdf..231002a67e3 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(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), + change: sys => sys.writeFile(`${VirtualFS.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(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), + change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${VirtualFS.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 => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)), + .map(f => VirtualFS.getTsBuildProjectFile("noEmitOnError", f)), { path: libFile.path, content: libContent } ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/noEmitOnError` } ), changes: [ noChange, @@ -43,4 +43,4 @@ const a: string = "hello";`), baselineIncremental: true }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index e6ba2f0e93e..2a995892adb 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,5 +1,5 @@ namespace ts.tscWatch { - import projectsLocation = TestFSWithWatch.tsbuildProjectsLocation; + import projectsLocation = VirtualFS.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 `${TestFSWithWatch.getTsBuildProjectFilePath("sample1", subProject)}/${baseFileName.toLowerCase()}`; + return `${VirtualFS.getTsBuildProjectFilePath("sample1", subProject)}/${baseFileName.toLowerCase()}`; } function projectFile(subProject: SubProject, baseFileName: string): File { - return TestFSWithWatch.getTsBuildProjectFile("sample1", `${subProject}/${baseFileName}`); + return VirtualFS.getTsBuildProjectFile("sample1", `${subProject}/${baseFileName}`); } function subProjectFiles(subProject: SubProject, anotherModuleAndSomeDecl?: true): SubProjectFiles { @@ -739,4 +739,4 @@ export function someFn() { }`), ] }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsbuildWatch/reexport.ts b/src/testRunner/unittests/tsbuildWatch/reexport.ts index d105bd0fcf0..1d24cc3e2d7 100644 --- a/src/testRunner/unittests/tsbuildWatch/reexport.ts +++ b/src/testRunner/unittests/tsbuildWatch/reexport.ts @@ -17,23 +17,23 @@ 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 => TestFSWithWatch.getTsBuildProjectFile("reexport", f)), + .map(f => VirtualFS.getTsBuildProjectFile("reexport", f)), { path: libFile.path, content: libContent } ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/reexport` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/reexport` } ), changes: [ { caption: "Introduce error", - change: sys => replaceFileText(sys, `${TestFSWithWatch.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "// ", ""), + change: sys => replaceFileText(sys, `${VirtualFS.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "// ", ""), timeouts: build, }, { caption: "Fix error", - change: sys => replaceFileText(sys, `${TestFSWithWatch.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "bar: ", "// bar: "), + change: sys => replaceFileText(sys, `${VirtualFS.tsbuildProjectsLocation}/reexport/src/pure/session.ts`, "bar: ", "// bar: "), timeouts: build } ] }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index a01b35f5a98..0d77be0b08f 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -7,13 +7,13 @@ namespace ts.tscWatch { describe("when watchFile is single watcher per file", () => { verifyWatchFileOnMultipleProjects( /*singleWatchPerFile*/ true, - arrayToMap(["TSC_WATCHFILE"], identity, () => TestFSWithWatch.Tsc_WatchFile.SingleFileWatcherPerName) + arrayToMap(["TSC_WATCHFILE"], identity, () => VirtualFS.Tsc_WatchFile.SingleFileWatcherPerName) ); }); function verifyWatchFileOnMultipleProjects(singleWatchPerFile: boolean, environmentVariables?: ESMap) { it("watchFile on same file multiple times because file is part of multiple projects", () => { - const project = `${TestFSWithWatch.tsbuildProjectsLocation}/myproject`; + const project = `${VirtualFS.tsbuildProjectsLocation}/myproject`; let maxPkgs = 4; const configPath = `${project}/tsconfig.json`; const typing: File = { @@ -105,7 +105,7 @@ namespace ts.tscWatch { } ]; } - function writePkgReferences(system: TestFSWithWatch.TestServerHost) { + function writePkgReferences(system: VirtualFS.TestServerHost) { system.writeFile(configPath, JSON.stringify({ files: [], include: [], diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index f345d4a3c8f..07f195fb79f 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -2,13 +2,13 @@ namespace ts { describe("unittests:: tsc:: declarationEmit::", () => { interface VerifyDeclarationEmitInput { subScenario: string; - files: TestFSWithWatch.FileOrFolderOrSymLink[]; + files: VirtualFS.FileOrFolderOrSymLink[]; rootProject: string; changeCaseFileTestPath: (path: string) => boolean; } - function changeCaseFile(file: TestFSWithWatch.FileOrFolderOrSymLink, testPath: (path: string) => boolean, replacePath: (path: string) => string): TestFSWithWatch.FileOrFolderOrSymLink { - return !TestFSWithWatch.isSymLink(file) || !testPath(file.symLink) ? + function changeCaseFile(file: VirtualFS.FileOrFolderOrSymLink, testPath: (path: string) => boolean, replacePath: (path: string) => string): VirtualFS.FileOrFolderOrSymLink { + return !VirtualFS.isSymLink(file) || !testPath(file.symLink) ? testPath(file.path) ? { ...file, path: replacePath(file.path) } : file : { path: testPath(file.path) ? replacePath(file.path) : file.path, symLink: replacePath(file.symLink) }; } diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 598b422d5ba..e3d906a6dd7 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -343,24 +343,24 @@ export class Data2 { function change(caption: string, content: string): TscWatchCompileChange { return { caption, - change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), + change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, content), // build project timeouts: checkSingleTimeoutQueueLengthAndRun }; } const noChange: TscWatchCompileChange = { caption: "No change", - change: sys => sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), + change: sys => sys.writeFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, sys.readFile(`${VirtualFS.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`)!), // build project timeouts: checkSingleTimeoutQueueLengthAndRun, }; verifyEmitAndErrorUpdates({ subScenario: "with noEmitOnError", - currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError`, + currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/noEmitOnError`, files: () => ["shared/types/db.ts", "src/main.ts", "src/other.ts"] - .map(f => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)), + .map(f => VirtualFS.getTsBuildProjectFile("noEmitOnError", f)), lib: () => ({ path: libFile.path, content: libContent }), - configFile: () => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", "tsconfig.json"), + configFile: () => VirtualFS.getTsBuildProjectFile("noEmitOnError", "tsconfig.json"), 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 97d838cdf63..c4e1ce2ed16 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -1,18 +1,18 @@ namespace ts.tscWatch { export const projects = `/user/username/projects`; export const projectRoot = `${projects}/myproject`; - export import WatchedSystem = TestFSWithWatch.TestServerHost; - export type File = TestFSWithWatch.File; - export type SymLink = TestFSWithWatch.SymLink; - export import libFile = TestFSWithWatch.libFile; - export import createWatchedSystem = TestFSWithWatch.createWatchedSystem; - export import checkArray = TestFSWithWatch.checkArray; - export import checkWatchedFiles = TestFSWithWatch.checkWatchedFiles; - export import checkWatchedFilesDetailed = TestFSWithWatch.checkWatchedFilesDetailed; - export import checkWatchedDirectories = TestFSWithWatch.checkWatchedDirectories; - export import checkWatchedDirectoriesDetailed = TestFSWithWatch.checkWatchedDirectoriesDetailed; - export import checkOutputContains = TestFSWithWatch.checkOutputContains; - export import checkOutputDoesNotContain = TestFSWithWatch.checkOutputDoesNotContain; + export import WatchedSystem = VirtualFS.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 checkWatchedFiles = VirtualFS.checkWatchedFiles; + export import checkWatchedFilesDetailed = VirtualFS.checkWatchedFilesDetailed; + export import checkWatchedDirectories = VirtualFS.checkWatchedDirectories; + export import checkWatchedDirectoriesDetailed = VirtualFS.checkWatchedDirectoriesDetailed; + export import checkOutputContains = VirtualFS.checkOutputContains; + export import checkOutputDoesNotContain = VirtualFS.checkOutputDoesNotContain; export const commonFile1: File = { path: "/a/b/commonFile1.ts", @@ -102,9 +102,9 @@ namespace ts.tscWatch { export type WatchOrSolution = void | SolutionBuilder | WatchOfConfigFile | WatchOfFilesAndCompilerOptions; export interface TscWatchCompileChange { caption: string; - change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void; + change: (sys: VirtualFS.TestServerHostTrackingWrittenFiles) => void; timeouts: ( - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + sys: VirtualFS.TestServerHostTrackingWrittenFiles, programs: readonly CommandLineProgram[], watchOrSolution: WatchOrSolution ) => void; @@ -164,7 +164,7 @@ namespace ts.tscWatch { export interface BaselineBase { baseline: string[]; - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; + sys: VirtualFS.TestServerHostTrackingWrittenFiles; oldSnap: SystemSnap; } @@ -174,7 +174,7 @@ namespace ts.tscWatch { export function createBaseline(system: WatchedSystem, modifySystem?: (sys: WatchedSystem) => void): Baseline { const initialSys = fakes.patchHostForBuildInfoReadWrite(system); modifySystem?.(initialSys); - const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles(initialSys); + const sys = VirtualFS.changeToHostTrackingWrittenFiles(initialSys); const baseline: string[] = []; baseline.push("Input::"); sys.diff(baseline); @@ -246,7 +246,7 @@ namespace ts.tscWatch { } export interface RunWatchBaseline extends BaselineBase, TscWatchCompileBase { - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; + sys: VirtualFS.TestServerHostTrackingWrittenFiles; getPrograms: () => readonly CommandLineProgram[]; watchOrSolution: WatchOrSolution; } @@ -419,12 +419,12 @@ namespace ts.tscWatch { assert.equal(host.getOutput().length, 0, JSON.stringify(host.getOutput(), /*replacer*/ undefined, " ")); } - export function createSystemWithSolutionBuild(solutionRoots: readonly string[], files: readonly TestFSWithWatch.FileOrFolderOrSymLink[], params?: TestFSWithWatch.TestServerHostCreationParameters) { + export function createSystemWithSolutionBuild(solutionRoots: readonly string[], files: readonly VirtualFS.FileOrFolderOrSymLink[], params?: VirtualFS.TestServerHostCreationParameters) { const sys = createWatchedSystem(files, params); const originalReadFile = sys.readFile; const originalWrite = sys.write; const originalWriteFile = sys.writeFile; - const solutionBuilder = createSolutionBuilder(TestFSWithWatch.changeToHostTrackingWrittenFiles( + const solutionBuilder = createSolutionBuilder(VirtualFS.changeToHostTrackingWrittenFiles( fakes.patchHostForBuildInfoReadWrite(sys) ), solutionRoots, {}); solutionBuilder.build(); diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 83b65de1bda..0facf1928cb 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -7,23 +7,23 @@ namespace ts.tscWatch { ["tests"], [ libFile, - 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"), + 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"), ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/sample1` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/sample1` } ), commandLineArgs: ["-w", "-p", "tests"], changes: [ { caption: "local edit in logic ts, and build logic", change: sys => { - sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `function foo() { }`); + sys.appendFile(VirtualFS.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(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/index.ts"), `export function gfoo() { }`); + sys.appendFile(VirtualFS.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(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic/tsconfig.json"), JSON.stringify({ + sys.writeFile(VirtualFS.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, - 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"), + 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"), ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "tsconfig.c.json"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), `export function gfoo() { }`); + sys.appendFile(VirtualFS.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: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] }); + changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert deleting referenced config file", - change: sys => sys.ensureFileOrFolder(TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")), + change: sys => sys.ensureFileOrFolder(VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting transitively referenced config file", - change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert deleting transitively referenced config file", - change: sys => sys.ensureFileOrFolder(TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")), + change: sys => sys.ensureFileOrFolder(VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")), timeouts: checkSingleTimeoutQueueLengthAndRun }, ], @@ -147,25 +147,25 @@ namespace ts.tscWatch { ["tsconfig.c.json"], [ libFile, - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json"), { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), content: JSON.stringify({ compilerOptions: { composite: true, moduleResolution: "classic" }, files: ["b.ts"], references: [{ path: "tsconfig.a.json" }] }) }, - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "a.ts"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "tsconfig.c.json"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "a.ts"), { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b.ts"), content: `import {A} from "a";export const b = new A();` }, - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "c.ts"), - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "c.ts"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "tsconfig.c.json"], changes: emptyArray, @@ -180,14 +180,14 @@ namespace ts.tscWatch { [ libFile, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true }, files: ["index.ts"] }), }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + path: VirtualFS.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: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, files: ["index.ts"], @@ -203,31 +203,31 @@ namespace ts.tscWatch { }), }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), content: `export class A {}`, }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), content: `import {A} from '@ref/a'; export const b = new A();`, }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), content: `import {b} from '../b'; import {X} from "@ref/a"; b; X;`, }, - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "c"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); + sys.appendFile(VirtualFS.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: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); + changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting referenced config file", change: sys => sys.writeFile( - TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + VirtualFS.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(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting transitively referenced config file", change: sys => sys.writeFile( - TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true }, files: ["index.ts"] @@ -304,49 +304,49 @@ X;`, [ libFile, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true } }), }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), content: JSON.stringify({ compilerOptions: { composite: true, baseUrl: "./", paths: { "@ref/*": ["../*"] } }, references: [{ path: `../a` }] }), }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), content: JSON.stringify({ compilerOptions: { baseUrl: "./", paths: { "@ref/*": ["../refs/*"] } }, references: [{ path: `../b` }] }), }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/index.ts"), content: `export class A {}`, }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), content: `import {A} from '@ref/a'; export const b = new A();`, }, { - path: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/index.ts"), content: `import {b} from '../b'; import {X} from "@ref/a"; b; X;`, }, - TestFSWithWatch.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), + VirtualFS.getTsBuildProjectFile("transitiveReferences", "refs/a.d.ts"), ], - { currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/transitiveReferences` } + { currentDirectory: `${VirtualFS.tsbuildProjectsLocation}/transitiveReferences` } ), commandLineArgs: ["-w", "-p", "c"], changes: [ { caption: "non local edit b ts, and build b", change: sys => { - sys.appendFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/index.ts"), `export function gfoo() { }`); + sys.appendFile(VirtualFS.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: TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), - content: sys.readFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! + path: VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "nrefs/a.d.ts"), + content: sys.readFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "refs/a.d.ts"))! }); - changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); + changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }); }, timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "edit in referenced config file", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "Revert referenced config file edit", - change: sys => changeCompilerOpitonsPaths(sys, TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), + change: sys => changeCompilerOpitonsPaths(sys, VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }), timeouts: checkSingleTimeoutQueueLengthAndRun }, { caption: "deleting referenced config file", - change: sys => sys.deleteFile(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting referenced config file", change: sys => sys.writeFile( - TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), + VirtualFS.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(TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), + change: sys => sys.deleteFile(VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) }, { caption: "Revert deleting transitively referenced config file", change: sys => sys.writeFile( - TestFSWithWatch.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), + VirtualFS.getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"), JSON.stringify({ compilerOptions: { composite: true } }), ), timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2) @@ -411,4 +411,4 @@ X;`, baselineDependencies: true, }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 7152c0db97d..d81ead88b01 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -1,8 +1,8 @@ namespace ts.tscWatch { - import getFileFromProject = TestFSWithWatch.getTsBuildProjectFile; + import getFileFromProject = VirtualFS.getTsBuildProjectFile; describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedirect", () => { interface VerifyWatchInput { - files: readonly TestFSWithWatch.FileOrFolderOrSymLink[]; + files: readonly VirtualFS.FileOrFolderOrSymLink[]; config: string; subScenario: string; } diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index 477a982eafd..fb2c582d59e 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -204,7 +204,7 @@ namespace ts.tscWatch { function createWatch( baseline: string[], config: File, - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + sys: VirtualFS.TestServerHostTrackingWrittenFiles, createProgram: CreateProgram, optionsToExtend?: CompilerOptions, ) { @@ -246,9 +246,9 @@ namespace ts.tscWatch { function applyChangeForBuilderTest( baseline: string[], emitBaseline: string[], - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, - emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, - change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void, + sys: VirtualFS.TestServerHostTrackingWrittenFiles, + emitSys: VirtualFS.TestServerHostTrackingWrittenFiles, + change: (sys: VirtualFS.TestServerHostTrackingWrittenFiles) => void, caption: string ) { // Change file @@ -260,8 +260,8 @@ namespace ts.tscWatch { baseline: string[], emitBaseline: string[], config: File, - sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, - emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + sys: VirtualFS.TestServerHostTrackingWrittenFiles, + emitSys: VirtualFS.TestServerHostTrackingWrittenFiles, createProgram: CreateProgram, optionsToExtend?: CompilerOptions) { createWatch(baseline, config, sys, createProgram, optionsToExtend); diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index d02afa31377..21ef52e6017 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -1,5 +1,5 @@ namespace ts.tscWatch { - import Tsc_WatchDirectory = TestFSWithWatch.Tsc_WatchDirectory; + import Tsc_WatchDirectory = VirtualFS.Tsc_WatchDirectory; describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => { const scenario = "watchEnvironment"; verifyTscWatch({ @@ -13,7 +13,7 @@ namespace ts.tscWatch { content: "var z = 10;" }; const environmentVariables = new Map(); - environmentVariables.set("TSC_WATCHFILE", TestFSWithWatch.Tsc_WatchFile.DynamicPolling); + environmentVariables.set("TSC_WATCHFILE", VirtualFS.Tsc_WatchFile.DynamicPolling); return createWatchedSystem([file1, libFile], { environmentVariables }); }, changes: [ diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index 75ab596c38e..6dd4a70eb55 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -41,12 +41,12 @@ interface Array { length: number; [n: number]: T; }` ${file.fileContent}`; } // TODO: This is almost certainly in harness/virtualFileSystemHost.ts, or should be. - function verifyFileSystem(host: TestFSWithWatch.VirtualServerHost | undefined, files: protocol.FileSystemRequestArgs[]) { + function verifyFileSystem(host: VirtualFS.VirtualServerHost | undefined, files: protocol.FileSystemRequestArgs[]) { // 1. make sure that everything in files is there assert.isDefined(host); - const fs = (host as any).fs as ESMap; + const fs = (host as any).fs as ESMap; // console.log(Array.from(fs.values() as any as Iterable).filter(ts.TestFSWithWatch.isFsFile)) - assert.equal(Array.from(fs.values() as any as Iterable).filter(TestFSWithWatch.isFsFile).length, files.length); + assert.equal(Array.from(fs.values() as any as Iterable).filter(VirtualFS.isFsFile).length, files.length); for (const { file, fileContent } of files) { assert(host?.fileExists(file)); assert.equal(host!.readFile(file), fileContent); @@ -55,7 +55,7 @@ ${file.fileContent}`; } it("with updateFileSystem request", () => { // TODO: probably some other watcher tests, not sure what - const host = TestFSWithWatch.createVirtualServerHost([], { executingFilePath: "/a/tsc.js" }); + const host = VirtualFS.createVirtualServerHost([], { executingFilePath: "/a/tsc.js" }); const session = createVirtualFilesystemSession(host, host); const files = [app, file1, file2, file3, config, lib]; session.executeCommandSeq({ @@ -72,7 +72,7 @@ ${file.fileContent}`; }); const service = session.getProjectService(); // session -> service -> project const project = service.configuredProjects.get(config.file)!; - const fakehost = (session as any).host as TestFSWithWatch.VirtualServerHost; + const fakehost = (session as any).host as VirtualFS.VirtualServerHost; assert.isDefined(project); assert.equal(fakehost.fsWatches.size, 0); assert.equal(fakehost.fsWatchesRecursive.size, 2); diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index 34863897e8a..5c0bc2f2bc8 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -66,11 +66,11 @@ namespace ts.projectSystem { } function verifyCalledOnEachEntry(callback: CalledMaps, expectedKeys: ESMap) { - TestFSWithWatch.checkMap(callback, calledMaps[callback], expectedKeys); + VirtualFS.checkMap(callback, calledMaps[callback], expectedKeys); } function verifyCalledOnEachEntryNTimes(callback: CalledMaps, expectedKeys: readonly string[], nTimes: number) { - TestFSWithWatch.checkMap(callback, calledMaps[callback], expectedKeys, nTimes); + VirtualFS.checkMap(callback, calledMaps[callback], expectedKeys, nTimes); } function verifyNoHostCalls() { diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 2dd0ca4e478..0bd38794194 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -3,17 +3,17 @@ namespace ts.projectSystem { export import protocol = server.protocol; export import CommandNames = server.CommandNames; - export import TestServerHost = TestFSWithWatch.TestServerHost; - export type File = TestFSWithWatch.File; - export type SymLink = TestFSWithWatch.SymLink; - export type Folder = TestFSWithWatch.Folder; - export import createServerHost = TestFSWithWatch.createServerHost; - export import checkArray = TestFSWithWatch.checkArray; - export import libFile = TestFSWithWatch.libFile; - export import checkWatchedFiles = TestFSWithWatch.checkWatchedFiles; - export import checkWatchedFilesDetailed = TestFSWithWatch.checkWatchedFilesDetailed; - export import checkWatchedDirectories = TestFSWithWatch.checkWatchedDirectories; - export import checkWatchedDirectoriesDetailed = TestFSWithWatch.checkWatchedDirectoriesDetailed; + export import TestServerHost = VirtualFS.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 checkWatchedFiles = VirtualFS.checkWatchedFiles; + export import checkWatchedFilesDetailed = VirtualFS.checkWatchedFilesDetailed; + export import checkWatchedDirectories = VirtualFS.checkWatchedDirectories; + export import checkWatchedDirectoriesDetailed = VirtualFS.checkWatchedDirectoriesDetailed; export import commonFile1 = tscWatch.commonFile1; export import commonFile2 = tscWatch.commonFile2; @@ -138,7 +138,7 @@ namespace ts.projectSystem { installTypingHost: server.ServerHost, readonly typesRegistry = new Map>(), log?: TI.Log) { - super(installTypingHost, globalTypingsCacheLocation, TestFSWithWatch.safeList.path, customTypesMap.path, throttleLimit, log); + super(installTypingHost, globalTypingsCacheLocation, VirtualFS.safeList.path, customTypesMap.path, throttleLimit, log); } protected postExecActions: PostExecAction[] = []; @@ -414,7 +414,7 @@ namespace ts.projectSystem { } } - export function createVirtualFilesystemSession(host: server.ServerHost, fshost: TestFSWithWatch.VirtualServerHost | undefined, opts: Partial = {}) { + export function createVirtualFilesystemSession(host: server.ServerHost, fshost: VirtualFS.VirtualServerHost | undefined, opts: Partial = {}) { if (opts.typingsInstaller === undefined) { opts.typingsInstaller = new TestTypingsInstaller("/a/data/", /*throttleLimit*/ 5, host); } diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index 97132be83b7..e2faf34f30a 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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.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 = TestFSWithWatch.changeToHostTrackingWrittenFiles( + const host = VirtualFS.changeToHostTrackingWrittenFiles( createServerHost([dependencyTs, dependencyConfig, usageTs, usageConfig, libFile]) ); const session = createSession(host); @@ -2313,4 +2313,4 @@ ${appendDts}` assert.equal(host.readFile(sourceJs), expectedSiblingJs); }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index bae075912be..a2da7c0141e 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -1,5 +1,5 @@ namespace ts.projectSystem { - export function createHostWithSolutionBuild(files: readonly TestFSWithWatch.FileOrFolderOrSymLink[], rootNames: readonly string[]) { + export function createHostWithSolutionBuild(files: readonly VirtualFS.FileOrFolderOrSymLink[], rootNames: readonly string[]) { const host = createServerHost(files); // ts build should succeed tscWatch.ensureErrorFreeBuild(host, rootNames); @@ -10,8 +10,8 @@ namespace ts.projectSystem { describe("with container project", () => { function getProjectFiles(project: string): [File, File] { return [ - TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json"), - TestFSWithWatch.getTsBuildProjectFile(project, "index.ts"), + VirtualFS.getTsBuildProjectFile(project, "tsconfig.json"), + VirtualFS.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 = TestFSWithWatch.getTsBuildProjectFile(project, "tsconfig.json"); + const containerConfig = VirtualFS.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: TestFSWithWatch.getTsBuildProjectFilePath(project, project), + projectFileName: VirtualFS.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 5af193a70d8..d24e827bca3 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 = 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 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 host = createServerHost([libFile, coreConfig, coreIndex, coreAnotherModule, coreSomeDecl, logicConfig, logicIndex, testsConfig, testsIndex]); const service = createProjectService(host); service.openClientFile(testsIndex.path); @@ -16,9 +16,9 @@ namespace ts.projectSystem { checkWatchedFilesDetailed(host, [coreConfig, coreIndex, coreAnotherModule, logicConfig, logicIndex, testsConfig, libFile].map(f => f.path.toLowerCase()), 1); checkWatchedDirectoriesDetailed(host, emptyArray, 1, /*recursive*/ false); checkWatchedDirectoriesDetailed(host, [ - TestFSWithWatch.getTsBuildProjectFilePath("sample1", "core"), - TestFSWithWatch.getTsBuildProjectFilePath("sample1", "logic"), - ...getTypeRootsFromLocation(TestFSWithWatch.getTsBuildProjectFilePath("sample1", "tests")) + VirtualFS.getTsBuildProjectFilePath("sample1", "core"), + VirtualFS.getTsBuildProjectFilePath("sample1", "logic"), + ...getTypeRootsFromLocation(VirtualFS.getTsBuildProjectFilePath("sample1", "tests")) ], 1, /*recursive*/ true); // local edit in ts file @@ -525,4 +525,4 @@ export class A {}` }); }); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts index 616daf5fb1f..b64c34189a9 100644 --- a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts +++ b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts @@ -149,7 +149,7 @@ namespace ts.projectSystem { }); }); - function assertUsageError(files: readonly TestFSWithWatch.File[], openFile: TestFSWithWatch.File, diagnostic: DiagnosticMessage) { + function assertUsageError(files: readonly VirtualFS.File[], openFile: VirtualFS.File, diagnostic: DiagnosticMessage) { const host = createServerHost(files); const session = createSession(host); openFilesForSession([openFile], session); diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 1f3426aa8c7..f37877f0d77 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1169,13 +1169,13 @@ namespace ts.projectSystem { }); it("should redo resolution that resolved to '.js' file after typings are installed", () => { - const file: TestFSWithWatch.File = { + const file: VirtualFS.File = { path: `${tscWatch.projects}/a/b/app.js`, content: ` import * as commander from "commander";` }; const cachePath = `${tscWatch.projects}/a/cache`; - const commanderJS: TestFSWithWatch.File = { + const commanderJS: VirtualFS.File = { path: `${tscWatch.projects}/node_modules/commander/index.js`, content: "module.exports = 0", }; @@ -1189,7 +1189,7 @@ namespace ts.projectSystem { } installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction) { const installedTypings = typeNames.map(name => `@types/${name}`); - const typingFiles = typeNames.map((name): TestFSWithWatch.File => ({ path: typePath(name), content: "" })); + const typingFiles = typeNames.map((name): VirtualFS.File => ({ path: typePath(name), content: "" })); executeCommand(this, host, installedTypings, typingFiles, cb); } })(); @@ -2031,14 +2031,14 @@ namespace ts.projectSystem { }); it("should handle node core modules", () => { - const file: TestFSWithWatch.File = { + const file: VirtualFS.File = { path: "/a/b/app.js", content: `// @ts-check const net = require("net"); const stream = require("stream");` }; - const nodeTyping: TestFSWithWatch.File = { + const nodeTyping: VirtualFS.File = { path: `${globalTypingsCacheLocation}/node_modules/node/index.d.ts`, content: ` declare module "net" { diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 2624e1b6e34..2018979dae1 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -1,5 +1,5 @@ namespace ts.projectSystem { - import Tsc_WatchDirectory = TestFSWithWatch.Tsc_WatchDirectory; + import Tsc_WatchDirectory = VirtualFS.Tsc_WatchDirectory; describe("unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem watchDirectories implementation", () => { function verifyCompletionListWithNewFileInSubFolder(tscWatchDirectory: Tsc_WatchDirectory) { const projectFolder = "/a/username/project"; diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 3256b88c021..fad5b3f49d5 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 ? TestFSWithWatch.createVirtualServerHost([]) : sys as ServerHost; + const fshost = vfs ? VirtualFS.createVirtualServerHost([]) : sys as ServerHost; startServer( { globalPlugins: findArgumentStringArray("--globalPlugins"), diff --git a/src/vfs/virtualFileSystemWithWatch.ts b/src/vfs/virtualFileSystemWithWatch.ts index 4ee2fcecaf1..c201bd18e87 100644 --- a/src/vfs/virtualFileSystemWithWatch.ts +++ b/src/vfs/virtualFileSystemWithWatch.ts @@ -1,5 +1,5 @@ /* @internal */ -namespace ts.TestFSWithWatch { +namespace ts.VirtualFS { export interface VirtualServerHostCreationParameters { useCaseSensitiveFileNames?: boolean; executingFilePath: string; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 04d584b0362..4af00f86ee8 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -8333,24 +8333,21 @@ declare namespace ts.server.protocol { interface UpdateFileSystemRequestArgs { /** For now, only 'memfs', initially for exclusive in-memory operation, but it could be other in-memory names later */ fileSystem: string; - /** List of newly created or newly available files. */ - created: FileSystemRequestArgs[]; + /** List of newly created or updated files. */ + files: FileSystemRequestArgs[]; /** Names of just-deleted files. */ deleted: string[]; - /** List of updated files. */ - updated: FileSystemRequestArgs[]; } - interface FileSystemRequestArgs extends FileRequestArgs { + interface FileSystemRequestArgs { + /** + * The file for the request (absolute pathname required). + */ + file: string; /** * Used to replace the content that would be on disk. * Then the known content will be used upon opening instead of the disk copy */ - fileContent?: string; - /** - * Used to specify the script kind of the file explicitly. It could be one of the following: - * "TS", "JS", "TSX", "JSX" - */ - scriptKindName?: ScriptKindName; + fileContent: string; } /** * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects. @@ -10013,7 +10010,7 @@ declare namespace ts.server { private readonly cancellationToken; isNonTsProject(): boolean; isJsOnlyProject(): boolean; - static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined; + static resolveModule(moduleName: string, initialDir: string, host: ServerHost, fshost: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined; isKnownTypesPackageName(name: string): boolean; installPackage(options: InstallPackageOptions): Promise; private get typingsCache(); @@ -10327,6 +10324,7 @@ declare namespace ts.server { } export interface ProjectServiceOptions { host: ServerHost; + fshost: ServerHost | undefined; logger: Logger; cancellationToken: HostCancellationToken; useSingleInferredProject: boolean; @@ -10398,6 +10396,7 @@ declare namespace ts.server { readonly currentDirectory: NormalizedPath; readonly toCanonicalFileName: (f: string) => string; readonly host: ServerHost; + readonly fshost: ServerHost | undefined; readonly logger: Logger; readonly cancellationToken: HostCancellationToken; readonly useSingleInferredProject: boolean; @@ -10600,6 +10599,7 @@ declare namespace ts.server { } interface SessionOptions { host: ServerHost; + fshost: ServerHost | undefined; cancellationToken: ServerCancellationToken; useSingleInferredProject: boolean; useInferredProjectPerProjectRoot: boolean; @@ -10641,6 +10641,7 @@ declare namespace ts.server { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; + private fshost; constructor(opts: SessionOptions); private sendRequestCompletedEvent; private addPerformanceData;