1namespace ts { 2 describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { 3 let projFs: vfs.FileSystem; 4 before(() => { 5 projFs = loadProjectFromDisk("tests/projects/emitDeclarationOnly"); 6 }); 7 after(() => { 8 projFs = undefined!; 9 }); 10 11 function verifyEmitDeclarationOnly(disableMap?: true) { 12 verifyTscWithEdits({ 13 subScenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`, 14 fs: () => projFs, 15 scenario: "emitDeclarationOnly", 16 commandLineArgs: ["--b", "/src", "--verbose"], 17 modifyFs: disableMap ? 18 (fs => replaceText(fs, "/src/tsconfig.json", `"declarationMap": true,`, "")) : 19 undefined, 20 edits: [{ 21 subScenario: "incremental-declaration-changes", 22 modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), 23 }], 24 }); 25 } 26 verifyEmitDeclarationOnly(); 27 verifyEmitDeclarationOnly(/*disableMap*/ true); 28 29 verifyTscWithEdits({ 30 subScenario: `only dts output in non circular imports project with emitDeclarationOnly`, 31 fs: () => projFs, 32 scenario: "emitDeclarationOnly", 33 commandLineArgs: ["--b", "/src", "--verbose"], 34 modifyFs: fs => { 35 fs.rimrafSync("/src/src/index.ts"); 36 replaceText(fs, "/src/src/a.ts", `import { B } from "./b";`, `export class B { prop = "hello"; }`); 37 }, 38 edits: [ 39 { 40 subScenario: "incremental-declaration-doesnt-change", 41 modifyFs: fs => replaceText(fs, "/src/src/a.ts", "export interface A {", `class C { } 42export interface A {`), 43 44 }, 45 { 46 subScenario: "incremental-declaration-changes", 47 modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), 48 }, 49 ], 50 }); 51 }); 52} 53