1namespace ts { 2 describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the missing file", () => { 3 verifyTsc({ 4 scenario: "configFileErrors", 5 subScenario: "when tsconfig extends the missing file", 6 fs: () => loadProjectFromDisk("tests/projects/missingExtendedConfig"), 7 commandLineArgs: ["--b", "/src/tsconfig.json"], 8 }); 9 }); 10 11 describe("unittests:: tsbuild:: configFileErrors:: reports syntax errors in config file", () => { 12 function discrepancyExplanation() { 13 return [ 14 "During incremental build, tsbuildinfo is not emitted, so declaration option is not present", 15 "Clean build has declaration option in tsbuildinfo", 16 ]; 17 } 18 19 verifyTscWithEdits({ 20 scenario: "configFileErrors", 21 subScenario: "reports syntax errors in config file", 22 fs: () => loadProjectFromFiles({ 23 "/src/a.ts": "export function foo() { }", 24 "/src/b.ts": "export function bar() { }", 25 "/src/tsconfig.json": Utils.dedent` 26{ 27 "compilerOptions": { 28 "composite": true, 29 }, 30 "files": [ 31 "a.ts" 32 "b.ts" 33 ] 34}` 35 }), 36 commandLineArgs: ["--b", "/src/tsconfig.json"], 37 edits: [ 38 { 39 modifyFs: fs => replaceText(fs, "/src/tsconfig.json", ",", `, 40 "declaration": true,`), 41 subScenario: "reports syntax errors after change to config file", 42 discrepancyExplanation 43 }, 44 { 45 modifyFs: fs => appendText(fs, "/src/a.ts", "export function fooBar() { }"), 46 subScenario: "reports syntax errors after change to ts file", 47 discrepancyExplanation, 48 }, 49 { ...noChangeRun, discrepancyExplanation }, 50 { 51 modifyFs: fs => fs.writeFileSync( 52 "/src/tsconfig.json", 53 JSON.stringify({ 54 compilerOptions: { composite: true, declaration: true }, 55 files: ["a.ts", "b.ts"] 56 }) 57 ), 58 subScenario: "builds after fixing config file errors" 59 }, 60 ] 61 }); 62 }); 63} 64