/
noEmit.ts
34 lines (32 loc) · 1.38 KB
/
noEmit.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace ts {
describe("unittests:: tsbuild:: noEmit", () => {
function verifyNoEmitWorker(subScenario: string, aTsContent: string, commandLineArgs: readonly string[]) {
verifyTscWithEdits({
scenario: "noEmit",
subScenario,
fs: () => loadProjectFromFiles({
"/src/a.ts": aTsContent,
"/src/tsconfig.json": JSON.stringify({
compilerOptions: { noEmit: true }
})
}),
commandLineArgs,
edits: [
noChangeRun,
{
subScenario: "Fix error",
modifyFs: fs => fs.writeFileSync("/src/a.ts", `const a = "hello"`),
},
noChangeRun,
],
baselinePrograms: true,
});
}
function verifyNoEmit(subScenario: string, aTsContent: string) {
verifyNoEmitWorker(subScenario, aTsContent, ["--b", "/src/tsconfig.json", "-v"]);
verifyNoEmitWorker(`${subScenario} with incremental`, aTsContent, ["--b", "/src/tsconfig.json", "-v", "--incremental"]);
}
verifyNoEmit("syntax errors", `const a = "hello`);
verifyNoEmit("semantic errors", `const a: number = "hello"`);
});
}