diff --git a/src/testRunner/unittests/helpers/declarationEmit.ts b/src/testRunner/unittests/helpers/declarationEmit.ts index d3ca0d65a5c..8116b9f935d 100644 --- a/src/testRunner/unittests/helpers/declarationEmit.ts +++ b/src/testRunner/unittests/helpers/declarationEmit.ts @@ -34,7 +34,7 @@ function getSysForDeclarationEmitWithErrors(options: CompilerOptions, incrementa type: "module", main: "./distribution/index.js", }), - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } function getSysForDeclarationEmitWithErrorsWithOutFile(options: CompilerOptions, incremental: true | undefined) { @@ -61,7 +61,7 @@ function getSysForDeclarationEmitWithErrorsWithOutFile(options: CompilerOptions, declare const ky: KyInstance; export default ky; `, - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } export function forEachDeclarationEmitWithErrorsScenario( diff --git a/src/testRunner/unittests/helpers/noCheck.ts b/src/testRunner/unittests/helpers/noCheck.ts index 752880c8cb3..28ce347bad5 100644 --- a/src/testRunner/unittests/helpers/noCheck.ts +++ b/src/testRunner/unittests/helpers/noCheck.ts @@ -53,7 +53,7 @@ export function forEachTscScenarioWithNoCheck(buildType: "-b" | "-p") { ...options, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: [...commandLineArgs, "--noCheck"], edits: [ noChangeRun, // Should be no op diff --git a/src/testRunner/unittests/helpers/noEmit.ts b/src/testRunner/unittests/helpers/noEmit.ts index a33d7ff6dea..2d2b4e3c7f4 100644 --- a/src/testRunner/unittests/helpers/noEmit.ts +++ b/src/testRunner/unittests/helpers/noEmit.ts @@ -139,7 +139,7 @@ function forEachNoEmitChangesWorker(commandType: string[], compilerOptions: Comp "/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: compilerOptionsToConfigJson(compilerOptions), }), - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } } diff --git a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts index 89d6e316c59..d58f2053392 100644 --- a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts @@ -535,12 +535,20 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, static createWatchedSystem( fileOrFolderList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[], - params: - & Omit - & { currentDirectory: string; }, + params?: Omit, ): TestServerHost { - ensureWatchablePath(params.currentDirectory, `currentDirectory: ${params.currentDirectory}`); - return new TestServerHost(fileOrFolderList, params); + const useDefaultCurrentDirectory = !params?.currentDirectory; + if (useDefaultCurrentDirectory) (params ??= {}).currentDirectory = "/home/src/workspaces/project"; + else ensureWatchablePath(params!.currentDirectory!, `currentDirectory: ${params!.currentDirectory}`); + const host = new TestServerHost(fileOrFolderList, params); + if (useDefaultCurrentDirectory && fileOrFolderList !== emptyArray) { + const folder = host.getRealFolder(host.toPath(host.currentDirectory))!; + Debug.assert( + folder.entries.length, + `currentDirectory: Not specified, using default as "/home/src/workspaces/project". The files specified do not belong to it.`, + ); + } + return host; } static createServerHost( diff --git a/src/testRunner/unittests/tsbuild/commandLine.ts b/src/testRunner/unittests/tsbuild/commandLine.ts index 1fae82a3407..62c19e09c94 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -54,7 +54,7 @@ describe("unittests:: tsbuild:: commandLine::", () => { "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } function verify(options: ts.CompilerOptions) { verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/configFileErrors.ts b/src/testRunner/unittests/tsbuild/configFileErrors.ts index e5315b3d9ac..d74a91ab521 100644 --- a/src/testRunner/unittests/tsbuild/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuild/configFileErrors.ts @@ -33,7 +33,7 @@ describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the mis { path: "./tsconfig.second.json" }, ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--b"], }); }); @@ -57,7 +57,7 @@ describe("unittests:: tsbuild:: configFileErrors:: reports syntax errors in conf "b.ts" ] }`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--b"], edits: [ { diff --git a/src/testRunner/unittests/tsbuild/declarationEmit.ts b/src/testRunner/unittests/tsbuild/declarationEmit.ts index 6447b0d3196..0feee2034cc 100644 --- a/src/testRunner/unittests/tsbuild/declarationEmit.ts +++ b/src/testRunner/unittests/tsbuild/declarationEmit.ts @@ -124,7 +124,7 @@ export function fn4() { include: ["src"], references: [{ path: "../pkg1" }], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--b", "packages/pkg2/tsconfig.json", "--verbose"], }); diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index e1ed28f7eaa..14761b6ac72 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -49,7 +49,7 @@ describe("unittests:: tsbuild:: on project with emitDeclarationOnly:: set to tru emitDeclarationOnly: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } function verifyEmitDeclarationOnly(disableMap?: true) { diff --git a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts index 5de190bf2ba..166eb09621b 100644 --- a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts +++ b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts @@ -7,7 +7,7 @@ describe("unittests:: tsbuild:: exitCodeOnBogusFile:: test exit code", () => { verifyTsc({ scenario: "exitCodeOnBogusFile", subScenario: `test exit code`, - sys: () => TestServerHost.createWatchedSystem(emptyArray, { currentDirectory: "/home/src/workspaces/project" }), + sys: () => TestServerHost.createWatchedSystem(emptyArray), commandLineArgs: ["-b", "bogus.json"], }); }); diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index 902c306ae31..ff5e3e15cb0 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -19,10 +19,7 @@ describe("unittests:: tsbuild:: graphOrdering::", () => { ]; before(() => { - const sys = TestServerHost.createWatchedSystem(ts.emptyArray, { - useCaseSensitiveFileNames: true, - currentDirectory: "/home/src/workspaces/project", - }); + const sys = TestServerHost.createWatchedSystem(ts.emptyArray, { useCaseSensitiveFileNames: true }); host = ts.createSolutionBuilderHost(sys); writeProjects(sys, ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], deps); }); diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 34060ad6f7d..0690fea37c0 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -56,7 +56,7 @@ describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { incremental: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index 8187dd050ea..4efe2427ce8 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -34,7 +34,7 @@ describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contai incremental: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), scenario: "lateBoundSymbol", commandLineArgs: ["--b", "--verbose"], edits: [ diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts index ea40b3d22e8..c8f8f3d9143 100644 --- a/src/testRunner/unittests/tsbuild/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts @@ -88,7 +88,7 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio files: ["./pkg2_index.ts"], }), "/home/src/workspaces/project/packages/typeroot2/sometype/index.d.ts": dedent`declare type TheNum2 = "type2";`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-b", "packages/pkg1.tsconfig.json", "packages/pkg2.tsconfig.json", "--verbose", "--traceResolution"], }); }); @@ -119,7 +119,7 @@ describe("unittests:: tsbuild:: moduleResolution:: impliedNodeFormat differs bet name: "@types/pg", types: "index.d.ts", }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-b", "a", "b", "--verbose", "--traceResolution", "--explainFiles"], edits: noChangeOnlyRuns, }); @@ -167,7 +167,7 @@ describe("unittests:: tsbuild:: moduleResolution:: resolution sharing", () => { type: "module", }), "/home/src/workspaces/project/node_modules/a": { symLink: "/home/src/workspaces/project/packages/a" }, - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index c517b35666b..48007978ace 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -56,7 +56,7 @@ describe("unittests:: tsbuild:: outputPaths::", () => { outDir: "dist", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits, }, ["/home/src/workspaces/project/dist/index.js"]); @@ -71,7 +71,7 @@ describe("unittests:: tsbuild:: outputPaths::", () => { composite: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits, }, ["/home/src/workspaces/project/dist/src/index.js", "/home/src/workspaces/project/dist/src/index.d.ts"]); @@ -86,7 +86,7 @@ describe("unittests:: tsbuild:: outputPaths::", () => { rootDir: "src", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits, }, ["/home/src/workspaces/project/dist/index.js"]); @@ -102,7 +102,7 @@ describe("unittests:: tsbuild:: outputPaths::", () => { rootDir: "src", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits, }, ["/home/src/workspaces/project/dist/index.js"]); @@ -119,7 +119,7 @@ describe("unittests:: tsbuild:: outputPaths::", () => { composite: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits, }, ["/home/src/workspaces/project/dist/index.js", "/home/src/workspaces/project/dist/index.d.ts"]); }); diff --git a/src/testRunner/unittests/tsbuild/roots.ts b/src/testRunner/unittests/tsbuild/roots.ts index 51834fe179f..9aefaed552d 100644 --- a/src/testRunner/unittests/tsbuild/roots.ts +++ b/src/testRunner/unittests/tsbuild/roots.ts @@ -17,7 +17,7 @@ describe("unittests:: tsbuild:: roots::", () => { compilerOptions: { composite: true }, include: ["*.ts"], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "delete file1", edit: sys => { @@ -42,7 +42,7 @@ describe("unittests:: tsbuild:: roots::", () => { compilerOptions: { composite: true }, include: ["*.ts"], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "delete file1", edit: sys => { @@ -69,7 +69,7 @@ describe("unittests:: tsbuild:: roots::", () => { compilerOptions: { composite: true }, include: ["file*.ts"], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "delete file1", edit: sys => { @@ -109,7 +109,7 @@ describe("unittests:: tsbuild:: roots::", () => { compilerOptions: { composite: true }, include: ["file*.ts", "nonconsecutive*.ts", "asArray*.ts", "anotherNonConsecutive.ts"], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "delete file1", edit: sys => { diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index dfac8c97be9..bb1582022ab 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -194,7 +194,7 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => { "/home/src/workspaces/project/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": "{}", "/home/src/workspaces/project/tsconfig.tsbuildinfo": "Some random string", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--b", "-i", "-v"], edits: [{ caption: "tsbuildinfo written has error", diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts index 7f8f4697f86..518ad7290b0 100644 --- a/src/testRunner/unittests/tsc/composite.ts +++ b/src/testRunner/unittests/tsc/composite.ts @@ -21,7 +21,7 @@ describe("unittests:: tsc:: composite::", () => { "src/**/*.ts", ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--composite", "false"], }); @@ -41,7 +41,7 @@ describe("unittests:: tsc:: composite::", () => { "src/**/*.ts", ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--composite", "null"], }); @@ -62,7 +62,7 @@ describe("unittests:: tsc:: composite::", () => { "src/**/*.ts", ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--composite", "false"], }); @@ -83,7 +83,7 @@ describe("unittests:: tsc:: composite::", () => { "src/**/*.ts", ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--composite", "false", "--tsBuildInfoFile", "null"], }); @@ -99,7 +99,7 @@ describe("unittests:: tsc:: composite::", () => { composite: true, }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: [], edits: [ { diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index d3434602d54..fb0c2305fcb 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -29,7 +29,7 @@ describe("unittests:: tsc:: incremental::", () => { "src/**/*.ts", ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--incremental", "--tsBuildInfoFile", ".tsbuildinfo", "--explainFiles"], edits: noChangeOnlyRuns, }); @@ -46,7 +46,7 @@ describe("unittests:: tsc:: incremental::", () => { outDir: "dist", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--rootDir", "src"], edits: noChangeOnlyRuns, }); @@ -59,7 +59,7 @@ describe("unittests:: tsc:: incremental::", () => { "/home/src/workspaces/project/src/main.d.ts": "export const x = 10;", "/home/src/workspaces/project/src/another.d.ts": "export const y = 10;", "/home/src/workspaces/project/tsconfig.json": "{}", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--incremental"], edits: [ noChangeRun, @@ -83,7 +83,7 @@ describe("unittests:: tsc:: incremental::", () => { rootDir: "./", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ts.emptyArray, edits: noChangeOnlyRuns, }); @@ -96,7 +96,7 @@ describe("unittests:: tsc:: incremental::", () => { "/home/src/workspaces/project/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": "{}", "/home/src/workspaces/project/tsconfig.tsbuildinfo": "Some random string", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-i"], edits: [{ caption: "tsbuildinfo written has error", @@ -124,7 +124,7 @@ describe("unittests:: tsc:: incremental::", () => { compilerOptions: { composite: true }, include: ["src/**/*.ts"], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ts.emptyArray, edits: [ noChangeRun, @@ -185,7 +185,7 @@ declare global { "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition "/home/src/workspaces/project/src/index.tsx": `export const App = () =>
;`, "/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ts.emptyArray, }); @@ -198,7 +198,7 @@ declare global { "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition "/home/src/workspaces/project/src/index.tsx": `export const App = () =>
;`, "/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--strict"], }); }); @@ -289,7 +289,7 @@ declare global {
)`, [libFile.path]: `${libFile.content}\ninterface ReadonlyArray { readonly length: number }`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: noChangeOnlyRuns, }); @@ -317,7 +317,7 @@ declare global { outDir: "dist", }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--rootDir", "src"], }); @@ -332,7 +332,7 @@ declare global { console.log(a);`, "/home/src/workspaces/project/constants.ts": "export default 1;", "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./constants').default`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "Modify imports used in global file", edit: sys => sys.writeFile("/home/src/workspaces/project/constants.ts", "export default 2;"), @@ -351,7 +351,7 @@ console.log(a);`, "/home/src/workspaces/project/constants.ts": "export default 1;", "/home/src/workspaces/project/reexport.ts": `export { default as ConstantNumber } from "./constants"`, "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./reexport').ConstantNumber`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "Modify imports used in global file", edit: sys => sys.writeFile("/home/src/workspaces/project/constants.ts", "export default 2;"), @@ -380,7 +380,7 @@ console.log(a);`, const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson;`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), modifySystem: sys => sys.appendFile( libFile.path, @@ -448,7 +448,7 @@ console.log(a);`, "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, - }, { currentDirectory: "/home/src/workspaces/project" }); + }); } function enableDeclarationMap(): TestTscEdit { return { @@ -529,7 +529,7 @@ console.log(a);`, }), "/home/src/workspaces/project/file1.ts": `export class C { }`, "/home/src/workspaces/project/file2.ts": `export class D { }`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [ { caption: "delete file with imports", @@ -582,7 +582,7 @@ console.log(a);`, [K in keyof C]: { wrapped: C[K] } } `, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [{ caption: "modify js file", edit: sys => sys.appendFile("/home/src/workspaces/project/src/bug.js", `export const something = 1;`), @@ -635,7 +635,7 @@ console.log(a);`, ONE = 1 } `, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [ { caption: "change enum value", diff --git a/src/testRunner/unittests/tsc/libraryResolution.ts b/src/testRunner/unittests/tsc/libraryResolution.ts index 0e9b339e221..6d070e97667 100644 --- a/src/testRunner/unittests/tsc/libraryResolution.ts +++ b/src/testRunner/unittests/tsc/libraryResolution.ts @@ -48,7 +48,7 @@ describe("unittests:: tsc:: libraryResolution:: library file resolution", () => lib: ["es6"], }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: emptyArray, edits: [ { @@ -75,7 +75,7 @@ describe("unittests:: tsc:: libraryResolution:: library file resolution", () => lib: ["es6", "dom"], }, }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-i", "--explainFiles"], baselinePrograms: true, }); diff --git a/src/testRunner/unittests/tsc/listFilesOnly.ts b/src/testRunner/unittests/tsc/listFilesOnly.ts index 4cfb6c09bf7..3aa8bb88f15 100644 --- a/src/testRunner/unittests/tsc/listFilesOnly.ts +++ b/src/testRunner/unittests/tsc/listFilesOnly.ts @@ -11,7 +11,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { sys: () => TestServerHost.createWatchedSystem({ "/home/src/workspaces/project/test.ts": "export const x = 1;", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["test.ts", "--listFilesOnly"], }); @@ -22,7 +22,7 @@ describe("unittests:: tsc:: listFilesOnly::", () => { TestServerHost.createWatchedSystem({ "/home/src/workspaces/project/test.ts": "export const x = 1;", "/home/src/workspaces/project/tsconfig.json": "{}", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--incremental", "--listFilesOnly"], edits: [ { diff --git a/src/testRunner/unittests/tsc/moduleResolution.ts b/src/testRunner/unittests/tsc/moduleResolution.ts index 4b31093b56c..e44fc793648 100644 --- a/src/testRunner/unittests/tsc/moduleResolution.ts +++ b/src/testRunner/unittests/tsc/moduleResolution.ts @@ -191,7 +191,7 @@ describe("unittests:: tsc:: moduleResolution::", () => { `, "/home/src/workspaces/project/src/fileB.mts": "export function foo() {}", "/home/src/workspaces/project/package.json": jsonToReadableText({ name: "app", version: "1.0.0" }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-p", "src", "--explainFiles", "--extendedDiagnostics"], edits: [ { diff --git a/src/testRunner/unittests/tsc/noEmit.ts b/src/testRunner/unittests/tsc/noEmit.ts index 4aaf1cdc6f2..12f36f9f30e 100644 --- a/src/testRunner/unittests/tsc/noEmit.ts +++ b/src/testRunner/unittests/tsc/noEmit.ts @@ -26,7 +26,7 @@ describe("unittests:: tsc:: noEmit::", () => { }, }), "/home/src/workspaces/project/class1.ts": `export class class1 {}`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: noChangeOnlyRuns, baselinePrograms: true, }); diff --git a/src/testRunner/unittests/tsc/noEmitOnError.ts b/src/testRunner/unittests/tsc/noEmitOnError.ts index ce66efa377d..09959e154ea 100644 --- a/src/testRunner/unittests/tsc/noEmitOnError.ts +++ b/src/testRunner/unittests/tsc/noEmitOnError.ts @@ -21,7 +21,7 @@ describe("unittests:: tsc:: noEmitOnError::", () => { }), "/home/src/workspaces/project/a.ts": "const x = 10;", "/home/src/workspaces/project/b.ts": "const y = 10;", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: emptyArray, edits: [ { @@ -57,7 +57,7 @@ describe("unittests:: tsc:: noEmitOnError::", () => { }), "/home/src/workspaces/project/a.ts": "const x = 10;", "/home/src/workspaces/project/b.ts": "const y = 10;", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: emptyArray, edits: [ { @@ -90,7 +90,7 @@ describe("unittests:: tsc:: noEmitOnError::", () => { }), "/home/src/workspaces/project/file1.ts": `export const x: 30 = "hello";`, "/home/src/workspaces/project/file2.ts": `export class D { }`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-i"], edits: [{ caption: "delete file without error", @@ -113,7 +113,7 @@ describe("unittests:: tsc:: noEmitOnError::", () => { }), "/home/src/workspaces/project/file1.ts": `export const x: 30 = "hello";`, "/home/src/workspaces/project/file2.ts": `export class D { }`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["-i"], edits: [{ caption: "delete file without error", diff --git a/src/testRunner/unittests/tsc/projectReferences.ts b/src/testRunner/unittests/tsc/projectReferences.ts index 653bd7d8def..3a5b1e09de7 100644 --- a/src/testRunner/unittests/tsc/projectReferences.ts +++ b/src/testRunner/unittests/tsc/projectReferences.ts @@ -19,7 +19,7 @@ describe("unittests:: tsc:: projectReferences::", () => { { path: "../Util/Dates" }, ], }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: emptyArray, }); @@ -86,7 +86,7 @@ describe("unittests:: tsc:: projectReferences::", () => { import referencedSource from "../../lib/src/a"; // Error import referencedDeclaration from "../../lib/dist/a"; // Error import ambiguous from "ambiguous-package"; // Ok`, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "app", "--pretty", "false"], }); diff --git a/src/testRunner/unittests/tsc/projectReferencesConfig.ts b/src/testRunner/unittests/tsc/projectReferencesConfig.ts index 7856cda4835..fdcf11135ef 100644 --- a/src/testRunner/unittests/tsc/projectReferencesConfig.ts +++ b/src/testRunner/unittests/tsc/projectReferencesConfig.ts @@ -48,7 +48,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references meta ch references: ["../primary"], }), "/home/src/workspaces/project/secondary/b.ts": moduleImporting("../primary/a"), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "primary/tsconfig.json"], }); }); @@ -68,7 +68,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references constra }, }), "/home/src/workspaces/project/primary/a.ts": emptyModule(), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "primary/tsconfig.json"], }); @@ -90,7 +90,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references constra }, }), "/home/src/workspaces/project/reference/b.ts": moduleImporting("../primary/a"), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "reference/tsconfig.json"], }); @@ -112,7 +112,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references constra }, }), "/home/src/workspaces/project/reference/b.ts": moduleImporting("../primary/a"), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "reference/tsconfig.json"], }); @@ -128,7 +128,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references constra }), "/home/src/workspaces/project/primary/a.ts": "import * as b from './b'", "/home/src/workspaces/project/primary/b.ts": "export {}", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "primary/tsconfig.json"], }); @@ -141,7 +141,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references constra references: ["../foo"], }), "/home/src/workspaces/project/primary/a.ts": emptyModule(), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "primary/tsconfig.json"], }); }); @@ -162,7 +162,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references path ma references: ["../alpha"], }), "/home/src/workspaces/project/beta/b.ts": "import { m } from '../alpha/a'", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "beta/tsconfig.json", "--explainFiles"], }); }); @@ -179,7 +179,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references nice-be references: ["../alpha"], }), "/home/src/workspaces/project/beta/b.ts": "import { m } from '../alpha/a'", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "beta/tsconfig.json"], }); @@ -200,7 +200,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references nice-be }, }), "/home/src/workspaces/project/beta/b.ts": "import { m } from '@alpha/a'", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "beta/tsconfig.json"], }); }); @@ -216,7 +216,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references behavio TestServerHost.createWatchedSystem({ "/home/src/workspaces/project/alpha/tsconfig.json": getConfig(), "/home/src/workspaces/project/alpha/src/a.ts": "export const m: number = 3;", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "alpha/tsconfig.json"], }); }); @@ -230,7 +230,7 @@ describe("unittests:: tsc:: projectReferencesConfig:: project-references errors "/home/src/workspaces/project/alpha/tsconfig.json": getConfig(), "/home/src/workspaces/project/alpha/src/a.ts": "import * as b from '../../beta/b'", "/home/src/workspaces/project/beta/b.ts": "export { }", - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: ["--p", "alpha/tsconfig.json"], }); }); diff --git a/src/testRunner/unittests/tsc/redirect.ts b/src/testRunner/unittests/tsc/redirect.ts index 41e6352243a..d41d82fd7db 100644 --- a/src/testRunner/unittests/tsc/redirect.ts +++ b/src/testRunner/unittests/tsc/redirect.ts @@ -32,7 +32,7 @@ describe("unittests:: tsc:: redirect::", () => { version: "1.0.0", main: "index.js", }), - }, { currentDirectory: "/home/src/workspaces/project" }), + }), commandLineArgs: emptyArray, }); }); diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index d72379a9ef4..16d6113c27e 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -8,7 +8,6 @@ describe("unittests:: tsc:: runWithoutArgs::", () => { subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped", sys: () => TestServerHost.createWatchedSystem(emptyArray, { - currentDirectory: "/home/src/workspaces/project", environmentVariables: new Map([["TS_TEST_TERMINAL_WIDTH", "120"]]), }), commandLineArgs: emptyArray, @@ -17,10 +16,7 @@ describe("unittests:: tsc:: runWithoutArgs::", () => { verifyTsc({ scenario: "runWithoutArgs", subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped when host can't provide terminal width", - sys: () => - TestServerHost.createWatchedSystem(emptyArray, { - currentDirectory: "/home/src/workspaces/project", - }), + sys: () => TestServerHost.createWatchedSystem(emptyArray), commandLineArgs: emptyArray, }); @@ -29,7 +25,6 @@ describe("unittests:: tsc:: runWithoutArgs::", () => { subScenario: "does not add color when NO_COLOR is set", sys: () => TestServerHost.createWatchedSystem(emptyArray, { - currentDirectory: "/home/src/workspaces/project", environmentVariables: new Map([["NO_COLOR", "true"]]), }), commandLineArgs: emptyArray, diff --git a/src/testRunner/unittests/tscWatch/listFilesOnly.ts b/src/testRunner/unittests/tscWatch/listFilesOnly.ts index 00193914909..6a079f16f1c 100644 --- a/src/testRunner/unittests/tscWatch/listFilesOnly.ts +++ b/src/testRunner/unittests/tscWatch/listFilesOnly.ts @@ -8,7 +8,7 @@ describe("unittests:: tscWatch:: listFilesOnly::", () => { sys: () => { const sys = TestServerHost.createWatchedSystem({ "/home/src/workspaces/project/test.ts": "export const x = 1;", - }, { currentDirectory: "/home/src/workspaces/project" }); + }); sys.exit = exitCode => sys.exitCode = exitCode; return sys; }, diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 8a01bcf5fe6..a5597a77e5a 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -586,7 +586,7 @@ describe("unittests:: tscWatch:: moduleResolution::", () => { promisify(); promisify2(); `, - }, { currentDirectory: "/home/src/workspaces/project" }), + }), edits: [ { caption: "remove a file that will remove module augmentation",