diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 36aa7eba60c..c352481979c 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -56,11 +56,6 @@ namespace ts { ] ]; const relSources = sources.map(([config, sources]) => [relName(config), sources.map(relName)]) as any as [Sources, Sources, Sources]; - let expectedOutputFiles = [ - ...outputFiles[project.first], - ...outputFiles[project.second], - ...outputFiles[project.third] - ]; let initialExpectedDiagnostics: readonly fakes.ExpectedDiagnostic[] = [ getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], relOutputFiles[project.first][ext.js]], @@ -75,7 +70,6 @@ namespace ts { }); after(() => { outFileFs = undefined!; - expectedOutputFiles = undefined!; initialExpectedDiagnostics = undefined!; }); @@ -166,71 +160,37 @@ namespace ts { baselineOnly: true }); - it("clean projects", () => { + function getOutFileFsAfterBuild() { const fs = outFileFs.shadow(); - const expectedOutputs = [ - ...outputFiles[project.first], - ...outputFiles[project.second], - ...outputFiles[project.third] - ]; const host = fakes.SolutionBuilderHost.create(fs); const builder = createSolutionBuilder(host); builder.build(); - host.assertDiagnosticMessages(...initialExpectedDiagnostics); - // Verify they exist - verifyOutputsPresent(fs, expectedOutputs); - host.clearDiagnostics(); - builder.clean(); - host.assertDiagnosticMessages(/*none*/); - // Verify they are gone - verifyOutputsAbsent(fs, expectedOutputs); - // Subsequent clean shouldn't throw / etc - builder.clean(); + fs.makeReadonly(); + return fs; + } + + verifyTscIncrementalEdits({ + scenario: "outFile", + subScenario: "clean projects", + fs: getOutFileFsAfterBuild, + commandLineArgs: ["--b", "/src/third", "--clean"], + incrementalScenarios: [noChangeRun] }); - it("verify buildInfo absence results in new build", () => { - const { fs, tick } = getFsWithTime(outFileFs); - const expectedOutputs = [ - ...outputFiles[project.first], - ...outputFiles[project.second], - ...outputFiles[project.third] - ]; - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host); - builder.build(); - host.assertDiagnosticMessages(...initialExpectedDiagnostics); - // Verify they exist - verifyOutputsPresent(fs, expectedOutputs); - // Delete bundle info - host.clearDiagnostics(); - - tick(); - host.deleteFile(outputFiles[project.first][ext.buildinfo]); - tick(); - - builder = createSolutionBuilder(host); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], relOutputFiles[project.first][ext.buildinfo]], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]], - [Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.third][source.config], "src/first"], - [Diagnostics.Updating_output_of_project_0, sources[project.third][source.config]], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, sources[project.third][source.config]], - ); + verifyTsc({ + scenario: "outFile", + subScenario: "verify buildInfo absence results in new build", + fs: getOutFileFsAfterBuild, + commandLineArgs: ["--b", "/src/third", "--verbose"], + modifyFs: fs => fs.unlinkSync(outputFiles[project.first][ext.buildinfo]), }); - it("verify that if incremental is set to false, tsbuildinfo is not generated", () => { - const fs = outFileFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); - const builder = createSolutionBuilder(host); - builder.build(); - host.assertDiagnosticMessages(...initialExpectedDiagnostics); - // Verify they exist - without tsbuildinfo for third project - verifyOutputsPresent(fs, expectedOutputFiles.slice(0, expectedOutputFiles.length - 2)); - verifyOutputsAbsent(fs, [outputFiles[project.third][ext.buildinfo]]); + verifyTsc({ + scenario: "outFile", + subScenario: "tsbuildinfo is not generated when incremental is set to false", + fs: () => outFileFs, + commandLineArgs: ["--b", "/src/third", "--verbose"], + modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""), }); it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { @@ -747,44 +707,26 @@ ${internal} enum internalEnum { a, b, c }`); }); }); - it("non module projects without prepend", () => { - const fs = outFileFs.shadow(); - // No prepend - replaceText(fs, sources[project.third][source.config], `{ "path": "../first", "prepend": true }`, `{ "path": "../first" }`); - replaceText(fs, sources[project.third][source.config], `{ "path": "../second", "prepend": true }`, `{ "path": "../second" }`); + verifyTsc({ + scenario: "outFile", + subScenario: "non module projects without prepend", + fs: () => outFileFs, + commandLineArgs: ["--b", "/src/third", "--verbose"], + modifyFs: fs => { + // No prepend + replaceText(fs, sources[project.third][source.config], `{ "path": "../first", "prepend": true }`, `{ "path": "../first" }`); + replaceText(fs, sources[project.third][source.config], `{ "path": "../second", "prepend": true }`, `{ "path": "../second" }`); - // Non Modules - replaceText(fs, sources[project.first][source.config], `"composite": true,`, `"composite": true, "module": "none",`); - replaceText(fs, sources[project.second][source.config], `"composite": true,`, `"composite": true, "module": "none",`); - replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"composite": true, "module": "none",`); + // Non Modules + replaceText(fs, sources[project.first][source.config], `"composite": true,`, `"composite": true, "module": "none",`); + replaceText(fs, sources[project.second][source.config], `"composite": true,`, `"composite": true, "module": "none",`); + replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"composite": true, "module": "none",`); - // Own file emit - replaceText(fs, sources[project.first][source.config], `"outFile": "./bin/first-output.js",`, ""); - replaceText(fs, sources[project.second][source.config], `"outFile": "../2/second-output.js",`, ""); - replaceText(fs, sources[project.third][source.config], `"outFile": "./thirdjs/output/third-output.js",`, ""); - - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], "src/first/first_PART1.js"], - [Diagnostics.Building_project_0, sources[project.first][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.second][source.config], "src/second/second_part1.js"], - [Diagnostics.Building_project_0, sources[project.second][source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.third][source.config], "src/third/third_part1.js"], - [Diagnostics.Building_project_0, sources[project.third][source.config]] - ); - const expectedOutputFiles = flatMap(sources, ([config, ts]) => [ - removeFileExtension(config) + Extension.TsBuildInfo, - ...flatMap(ts, f => [ - removeFileExtension(f) + Extension.Js, - removeFileExtension(f) + Extension.Js + ".map", - removeFileExtension(f) + Extension.Dts, - removeFileExtension(f) + Extension.Dts + ".map", - ]) - ]); - verifyOutputsPresent(fs, expectedOutputFiles); + // Own file emit + replaceText(fs, sources[project.first][source.config], `"outFile": "./bin/first-output.js",`, ""); + replaceText(fs, sources[project.second][source.config], `"outFile": "../2/second-output.js",`, ""); + replaceText(fs, sources[project.third][source.config], `"outFile": "./thirdjs/output/third-output.js",`, ""); + }, }); }); } diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/clean-projects.js b/tests/baselines/reference/tsbuild/outFile/initial-build/clean-projects.js new file mode 100644 index 00000000000..619b5b54656 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/clean-projects.js @@ -0,0 +1,20 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --clean +exitCode:: ExitStatus.Success + + +//// [/src/2/second-output.d.ts] unlink +//// [/src/2/second-output.d.ts.map] unlink +//// [/src/2/second-output.js] unlink +//// [/src/2/second-output.js.map] unlink +//// [/src/2/second-output.tsbuildinfo] unlink +//// [/src/first/bin/first-output.d.ts] unlink +//// [/src/first/bin/first-output.d.ts.map] unlink +//// [/src/first/bin/first-output.js] unlink +//// [/src/first/bin/first-output.js.map] unlink +//// [/src/first/bin/first-output.tsbuildinfo] unlink +//// [/src/third/thirdjs/output/third-output.d.ts] unlink +//// [/src/third/thirdjs/output/third-output.d.ts.map] unlink +//// [/src/third/thirdjs/output/third-output.js] unlink +//// [/src/third/thirdjs/output/third-output.js.map] unlink +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] unlink diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/non-module-projects-without-prepend.js b/tests/baselines/reference/tsbuild/outFile/initial-build/non-module-projects-without-prepend.js new file mode 100644 index 00000000000..6fde70fe4cf --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/non-module-projects-without-prepend.js @@ -0,0 +1,334 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/first_PART1.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/second/second_part1.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/third_part1.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/first/first_PART1.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +//# sourceMappingURL=first_PART1.d.ts.map + +//// [/src/first/first_PART1.d.ts.map] +{"version":3,"file":"first_PART1.d.ts","sourceRoot":"","sources":["first_PART1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb"} + +//// [/src/first/first_PART1.js] +var s = "Hello, world"; +console.log(s); +//# sourceMappingURL=first_PART1.js.map + +//// [/src/first/first_PART1.js.map] +{"version":3,"file":"first_PART1.js","sourceRoot":"","sources":["first_PART1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"} + +//// [/src/first/first_part2.d.ts] +//# sourceMappingURL=first_part2.d.ts.map + +//// [/src/first/first_part2.d.ts.map] +{"version":3,"file":"first_part2.d.ts","sourceRoot":"","sources":["first_part2.ts"],"names":[],"mappings":""} + +//// [/src/first/first_part2.js] +console.log(f()); +//# sourceMappingURL=first_part2.js.map + +//// [/src/first/first_part2.js.map] +{"version":3,"file":"first_part2.js","sourceRoot":"","sources":["first_part2.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC"} + +//// [/src/first/first_part3.d.ts] +declare function f(): string; +//# sourceMappingURL=first_part3.d.ts.map + +//// [/src/first/first_part3.d.ts.map] +{"version":3,"file":"first_part3.d.ts","sourceRoot":"","sources":["first_part3.ts"],"names":[],"mappings":"AAAA,iBAAS,CAAC,WAET"} + +//// [/src/first/first_part3.js] +function f() { + return "JS does hoists"; +} +//# sourceMappingURL=first_part3.js.map + +//// [/src/first/first_part3.js.map] +{"version":3,"file":"first_part3.js","sourceRoot":"","sources":["first_part3.ts"],"names":[],"mappings":"AAAA,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"} + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, "module": "none", + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + + "skipDefaultLibCheck": true + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/first/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./first_part1.ts": { + "version": "-17207381411-interface TheFirst {\r\n none: any;\r\n}\r\n\r\nconst s = \"Hello, world\";\r\n\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n\r\nconsole.log(s);\r\n", + "signature": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map" + }, + "./first_part2.ts": { + "version": "4973778178-console.log(f());\r\n", + "signature": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map" + }, + "./first_part3.ts": { + "version": "6202806249-function f() {\r\n return \"JS does hoists\";\r\n}", + "signature": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map" + } + }, + "options": { + "target": 1, + "composite": true, + "module": 0, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./first_part1.ts", + "./first_part2.ts", + "./first_part3.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/second/second_part1.d.ts] +declare namespace N { +} +declare namespace N { +} +//# sourceMappingURL=second_part1.d.ts.map + +//// [/src/second/second_part1.d.ts.map] +{"version":3,"file":"second_part1.d.ts","sourceRoot":"","sources":["second_part1.ts"],"names":[],"mappings":"AAAA,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX"} + +//// [/src/second/second_part1.js] +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +//# sourceMappingURL=second_part1.js.map + +//// [/src/second/second_part1.js.map] +{"version":3,"file":"second_part1.js","sourceRoot":"","sources":["second_part1.ts"],"names":[],"mappings":"AAIA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV"} + +//// [/src/second/second_part2.d.ts] +declare class C { + doSomething(): void; +} +//# sourceMappingURL=second_part2.d.ts.map + +//// [/src/second/second_part2.d.ts.map] +{"version":3,"file":"second_part2.d.ts","sourceRoot":"","sources":["second_part2.ts"],"names":[],"mappings":"AAAA,cAAM,CAAC;IACH,WAAW;CAGd"} + +//// [/src/second/second_part2.js] +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +//# sourceMappingURL=second_part2.js.map + +//// [/src/second/second_part2.js.map] +{"version":3,"file":"second_part2.js","sourceRoot":"","sources":["second_part2.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"} + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, "module": "none", + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/src/second/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./second_part1.ts": { + "version": "-21603042336-namespace N {\r\n // Comment text\r\n}\r\n\r\nnamespace N {\r\n function f() {\r\n console.log('testing');\r\n }\r\n\r\n f();\r\n}\r\n", + "signature": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map" + }, + "./second_part2.ts": { + "version": "9339262372-class C {\r\n doSomething() {\r\n console.log(\"something got done\");\r\n }\r\n}\r\n", + "signature": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map" + } + }, + "options": { + "target": 1, + "composite": true, + "module": 0, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./second_part1.ts", + "./second_part2.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/third/third_part1.d.ts] +declare var c: C; +//# sourceMappingURL=third_part1.d.ts.map + +//// [/src/third/third_part1.d.ts.map] +{"version":3,"file":"third_part1.d.ts","sourceRoot":"","sources":["third_part1.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/third_part1.js] +var c = new C(); +c.doSomething(); +//# sourceMappingURL=third_part1.js.map + +//// [/src/third/third_part1.js.map] +{"version":3,"file":"third_part1.js","sourceRoot":"","sources":["third_part1.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"} + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, "module": "none", + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + + "skipDefaultLibCheck": true + }, + "files": [ + "third_part1.ts" + ], + "references": [ + { "path": "../first" }, + { "path": "../second" }, + ] +} + + +//// [/src/third/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "../first/first_part1.d.ts": { + "version": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map", + "signature": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map" + }, + "../first/first_part2.d.ts": { + "version": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map", + "signature": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map" + }, + "../first/first_part3.d.ts": { + "version": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map", + "signature": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map" + }, + "../second/second_part1.d.ts": { + "version": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map", + "signature": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map" + }, + "../second/second_part2.d.ts": { + "version": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map", + "signature": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map" + }, + "./third_part1.ts": { + "version": "10470273651-var c = new C();\r\nc.doSomething();\r\n", + "signature": "2019699827-declare var c: C;\r\n//# sourceMappingURL=third_part1.d.ts.map" + } + }, + "options": { + "target": 1, + "composite": true, + "module": 0, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../first/first_part1.d.ts", + "../first/first_part2.d.ts", + "../first/first_part3.d.ts", + "../second/second_part1.d.ts", + "../second/second_part2.d.ts", + "./third_part1.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/tsbuildinfo-is-not-generated-when-incremental-is-set-to-false.js b/tests/baselines/reference/tsbuild/outFile/initial-build/tsbuildinfo-is-not-generated-when-incremental-is-set-to-false.js new file mode 100644 index 00000000000..30fe2be5a86 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/tsbuildinfo-is-not-generated-when-incremental-is-set-to-false.js @@ -0,0 +1,281 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +12:00:00 AM - Building project '/src/second/tsconfig.json'... + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/2/second-output.d.ts] +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} +//# sourceMappingURL=second-output.d.ts.map + +//// [/src/2/second-output.d.ts.map] +{"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd"} + +//// [/src/2/second-output.js] +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +//# sourceMappingURL=second-output.js.map + +//// [/src/2/second-output.js.map] +{"version":3,"file":"second-output.js","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAIA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"} + +//// [/src/2/second-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../second", + "sourceFiles": [ + "../second/second_part1.ts", + "../second/second_part2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 285, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 100, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/2/second-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/2/second-output.js +---------------------------------------------------------------------- +text: (0-285) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +====================================================================== +====================================================================== +File:: /src/2/second-output.d.ts +---------------------------------------------------------------------- +text: (0-100) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +====================================================================== + +//// [/src/first/bin/first-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.js] +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.js.map] +{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"} + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +var c = new C(); +c.doSomething(); +//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.js.map] +{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part2.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC;ACED,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC;ACJD,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"} + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "./thirdjs/output/third-output.js", + "skipDefaultLibCheck": true + }, + "files": [ + "third_part1.ts" + ], + "references": [ + { "path": "../first", "prepend": true }, + { "path": "../second", "prepend": true }, + ] +} + + diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/verify-buildInfo-absence-results-in-new-build.js b/tests/baselines/reference/tsbuild/outFile/initial-build/verify-buildInfo-absence-results-in-new-build.js new file mode 100644 index 00000000000..310e56c01fb --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/verify-buildInfo-absence-results-in-new-build.js @@ -0,0 +1,129 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/third --verbose +12:00:00 AM - Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.tsbuildinfo' does not exist + +12:00:00 AM - Building project '/src/first/tsconfig.json'... + +12:00:00 AM - Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +12:00:00 AM - Updating output of project '/src/third/tsconfig.json'... + +12:00:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.js] file written with same contents +//// [/src/first/bin/first-output.js.map] file written with same contents +//// [/src/first/bin/first-output.tsbuildinfo] file written with same contents +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] file written with same contents +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/third/thirdjs/output/third-output.js +---------------------------------------------------------------------- +prepend: (0-110):: ../../../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +prepend: (110-395):: ../../../2/second-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (110-395) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +---------------------------------------------------------------------- +text: (395-431) +var c = new C(); +c.doSomething(); + +====================================================================== +====================================================================== +File:: /src/third/thirdjs/output/third-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../../../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +prepend: (157-257):: ../../../2/second-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (157-257) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +---------------------------------------------------------------------- +text: (257-276) +declare var c: C; + +====================================================================== + diff --git a/tests/baselines/reference/tsbuild/outFile/no-change-run/clean-projects.js b/tests/baselines/reference/tsbuild/outFile/no-change-run/clean-projects.js new file mode 100644 index 00000000000..e9007f59a9b --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/no-change-run/clean-projects.js @@ -0,0 +1,5 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b /src/third --clean +exitCode:: ExitStatus.Success + +