Make "/home/src/workspaces/project" as default current directory without having to specify it for tsc tests (#59875)
This commit is contained in:
Родитель
f39fe7dbe6
Коммит
2fb1363b82
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -535,12 +535,20 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost,
|
|||
|
||||
static createWatchedSystem(
|
||||
fileOrFolderList: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[],
|
||||
params:
|
||||
& Omit<TestServerHostCreationParameters, "typingsInstallerGlobalCacheLocation" | "typingsInstallerTypesRegistry">
|
||||
& { currentDirectory: string; },
|
||||
params?: Omit<TestServerHostCreationParameters, "typingsInstallerGlobalCacheLocation" | "typingsInstallerTypesRegistry">,
|
||||
): 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(
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ export function fn4() {
|
|||
include: ["src"],
|
||||
references: [{ path: "../pkg1" }],
|
||||
}),
|
||||
}, { currentDirectory: "/home/src/workspaces/project" }),
|
||||
}),
|
||||
commandLineArgs: ["--b", "packages/pkg2/tsconfig.json", "--verbose"],
|
||||
});
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"],
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => {
|
|||
incremental: true,
|
||||
},
|
||||
}),
|
||||
}, { currentDirectory: "/home/src/workspaces/project" });
|
||||
});
|
||||
}
|
||||
|
||||
verifyTsc({
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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"]);
|
||||
});
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
@ -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 = () => <div propA={true}></div>;`,
|
||||
"/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 = () => <div propA={true}></div>;`,
|
||||
"/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 {
|
|||
<div />
|
||||
</Component>)`,
|
||||
[libFile.path]: `${libFile.content}\ninterface ReadonlyArray<T> { 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<ReturnType<typeof wrapper>>;
|
||||
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",
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"],
|
||||
});
|
||||
|
||||
|
|
|
@ -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"],
|
||||
});
|
||||
});
|
||||
|
|
|
@ -32,7 +32,7 @@ describe("unittests:: tsc:: redirect::", () => {
|
|||
version: "1.0.0",
|
||||
main: "index.js",
|
||||
}),
|
||||
}, { currentDirectory: "/home/src/workspaces/project" }),
|
||||
}),
|
||||
commandLineArgs: emptyArray,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
|
Загрузка…
Ссылка в новой задаче