Skip to content

Commit

Permalink
Tests for #41780
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Dec 3, 2020
1 parent aefccb6 commit b3d20a1
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions src/testRunner/unittests/tsbuild/outputPaths.ts
Expand Up @@ -11,8 +11,28 @@ namespace ts {
noChangeProject,
];

verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
function verify(input: Pick<VerifyTsBuildInput, "subScenario" | "fs" | "incrementalScenarios">, expectedOuptutNames: readonly string[]) {
verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
...input
});

it("verify getOutputFileNames", () => {
const sys = new fakes.System(input.fs().makeReadonly(), { executingFilePath: "/lib/tsc" }) as TscCompileSystem;
;
assert.deepEqual(
getOutputFileNames(
parseConfigFileWithSystem("/src/tsconfig.json", {}, {}, sys, noop)!,
"/src/src/index.ts",
/*ignoreCase*/ false
),
expectedOuptutNames
);
});
}

verify({
subScenario: "when rootDir is not specified",
fs: () => loadProjectFromFiles({
"/src/src/index.ts": "export const x = 10;",
Expand All @@ -22,12 +42,10 @@ namespace ts {
}
})
}),
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
incrementalScenarios,
});
}, ["/src/dist/index.js"]);

verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
verify({
subScenario: "when rootDir is not specified and is composite",
fs: () => loadProjectFromFiles({
"/src/src/index.ts": "export const x = 10;",
Expand All @@ -38,7 +56,6 @@ namespace ts {
}
})
}),
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
incrementalScenarios: [
noChangeRun,
{
Expand All @@ -50,10 +67,9 @@ namespace ts {
}
}
],
});
}, ["/src/dist/src/index.js", "/src/dist/src/index.d.ts"]);

verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
verify({
subScenario: "when rootDir is specified",
fs: () => loadProjectFromFiles({
"/src/src/index.ts": "export const x = 10;",
Expand All @@ -64,12 +80,10 @@ namespace ts {
}
})
}),
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
incrementalScenarios,
});
}, ["/src/dist/index.js"]);

verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
verify({
subScenario: "when rootDir is specified but not all files belong to rootDir",
fs: () => loadProjectFromFiles({
"/src/src/index.ts": "export const x = 10;",
Expand All @@ -81,12 +95,10 @@ namespace ts {
}
})
}),
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
incrementalScenarios,
});
}, ["/src/dist/index.js"]);

verifyTscSerializedIncrementalEdits({
scenario: "outputPaths",
verify({
subScenario: "when rootDir is specified but not all files belong to rootDir and is composite",
fs: () => loadProjectFromFiles({
"/src/src/index.ts": "export const x = 10;",
Expand All @@ -99,8 +111,7 @@ namespace ts {
}
})
}),
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"],
incrementalScenarios,
});
}, ["/src/dist/index.js", "/src/dist/index.d.ts"]);
});
}

0 comments on commit b3d20a1

Please sign in to comment.