From 2c4cf0d1d545223fafcb2461b1b7cf2ce34ef3e4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 15 Oct 2019 08:37:23 -0700 Subject: [PATCH 01/16] Do not write build info if there are no files to emit --- src/compiler/builder.ts | 3 +++ .../when-passing-filename-for-buildinfo-on-commandline.js | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index a1ae9e133fb..010aabb57fe 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -251,6 +251,9 @@ namespace ts { state.seenAffectedFiles = createMap(); } + state.emittedBuildInfo = !state.changedFilesSet.size && + !state.affectedFilesPendingEmit; + return state; } diff --git a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js b/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js index fae2a9ef15e..2b0a9fc8793 100644 --- a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js +++ b/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js @@ -3,4 +3,3 @@ exitCode:: 0 -//// [/src/project/.tsbuildinfo] file written with same contents From 333436b9a8847a4e988b3dfacf9d1d3115a4fc2f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 08:37:06 -0700 Subject: [PATCH 02/16] Some changes to incremental tests --- src/testRunner/unittests/tsc/helpers.ts | 8 +++++++- src/testRunner/unittests/tsc/incremental.ts | 8 +++----- .../when-passing-filename-for-buildinfo-on-commandline.js | 2 +- .../when-passing-rootDir-from-commandline.js | 5 +++++ 4 files changed, 16 insertions(+), 7 deletions(-) rename tests/baselines/reference/tsc/incremental/{incremental-declaration-doesnt-change => no-change-run}/when-passing-filename-for-buildinfo-on-commandline.js (60%) create mode 100644 tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 5d5f9517e65..85eb2a886e0 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -169,9 +169,15 @@ namespace ts { Initial = "initial-build", IncrementalDtsChange = "incremental-declaration-changes", IncrementalDtsUnchanged = "incremental-declaration-doesnt-change", - IncrementalHeadersChange = "incremental-headers-change-without-dts-changes" + IncrementalHeadersChange = "incremental-headers-change-without-dts-changes", + NoChangeRun ="no-change-run" } + export const noChangeRun: TscIncremental = { + buildKind: BuildKind.NoChangeRun, + modifyFs: noop + }; + export interface TscCompile { scenario: string; subScenario: string; diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 86d6cefe3b6..b3903b37d08 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -17,13 +17,10 @@ namespace ts { }`, }), commandLineArgs: ["--incremental", "--p", "src/project", "--tsBuildInfoFile", "src/project/.tsbuildinfo"], - incrementalScenarios: [{ - buildKind: BuildKind.IncrementalDtsUnchanged, - modifyFs: noop, - }] + incrementalScenarios: [noChangeRun] }); - verifyTsc({ + verifyTscIncrementalEdits({ scenario: "incremental", subScenario: "when passing rootDir from commandline", fs: () => loadProjectFromFiles({ @@ -37,6 +34,7 @@ namespace ts { }`, }), commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"], + incrementalScenarios: [noChangeRun] }); }); } diff --git a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js similarity index 60% rename from tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js rename to tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js index 2b0a9fc8793..5ebc3de7b42 100644 --- a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/when-passing-filename-for-buildinfo-on-commandline.js +++ b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js @@ -1,4 +1,4 @@ -//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +//// [/lib/no-change-runOutput.txt] /lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo exitCode:: 0 diff --git a/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js new file mode 100644 index 00000000000..a20c3d3f615 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js @@ -0,0 +1,5 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --p src/project --rootDir src/project/src +exitCode:: 0 + + From c8e6f1c2ebb188f8b505a9d01f477fe8fba6383b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 08:46:50 -0700 Subject: [PATCH 03/16] Convert some more tests into baselines --- .../tsbuild/containerOnlyReferenced.ts | 40 +----- ...ter-initial-build-doesnt-build-anything.js | 135 ++++++++++++++++++ ...ter-initial-build-doesnt-build-anything.js | 18 +++ 3 files changed, 159 insertions(+), 34 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js create mode 100644 tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js diff --git a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts index f621d956621..d1bcb321e52 100644 --- a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts +++ b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts @@ -9,40 +9,12 @@ namespace ts { projFs = undefined!; // Release the contents }); - function outputs(folder: string) { - return [ - `${folder}/index.js`, - `${folder}/index.d.ts`, - `${folder}/tsconfig.tsbuildinfo` - ]; - } - - it("verify that subsequent builds after initial build doesnt build anything", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - createSolutionBuilder(host, ["/src"], { verbose: true }).build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder/tsconfig.json", "src/src/folder/index.js"], - [Diagnostics.Building_project_0, "/src/src/folder/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder2/tsconfig.json", "src/src/folder2/index.js"], - [Diagnostics.Building_project_0, "/src/src/folder2/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"], - ); - verifyOutputsPresent(fs, [ - ...outputs("/src/src/folder"), - ...outputs("/src/src/folder2"), - ...outputs("/src/tests"), - ]); - host.clearDiagnostics(); - createSolutionBuilder(host, ["/src"], { verbose: true }).build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder/tsconfig.json", "src/src/folder/index.ts", "src/src/folder/index.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder2/tsconfig.json", "src/src/folder2/index.ts", "src/src/folder2/index.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"], - ); + verifyTscIncrementalEdits({ + scenario: "containerOnlyReferenced", + subScenario: "verify that subsequent builds after initial build doesnt build anything", + fs: () => projFs, + commandLineArgs: ["--b", "/src", "--verbose"], + incrementalScenarios: [noChangeRun] }); }); } diff --git a/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js b/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js new file mode 100644 index 00000000000..b6b8aee9bec --- /dev/null +++ b/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js @@ -0,0 +1,135 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src --verbose +12:01:00 AM - Projects in this build: + * src/src/folder/tsconfig.json + * src/src/folder2/tsconfig.json + * src/src/tsconfig.json + * src/tests/tsconfig.json + * src/tsconfig.json + +12:01:00 AM - Project 'src/src/folder/tsconfig.json' is out of date because output file 'src/src/folder/index.js' does not exist + +12:01:00 AM - Building project '/src/src/folder/tsconfig.json'... + +12:01:00 AM - Project 'src/src/folder2/tsconfig.json' is out of date because output file 'src/src/folder2/index.js' does not exist + +12:01:00 AM - Building project '/src/src/folder2/tsconfig.json'... + +12:01:00 AM - Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +12:01:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/src/folder/index.d.ts] +export declare const x = 10; + + +//// [/src/src/folder/index.js] +"use strict"; +exports.__esModule = true; +exports.x = 10; + + +//// [/src/src/folder/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; };" + }, + "./index.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6057683066-export declare const x = 10;\r\n" + } + }, + "options": { + "composite": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/src/folder2/index.d.ts] +export declare const x = 10; + + +//// [/src/src/folder2/index.js] +"use strict"; +exports.__esModule = true; +exports.x = 10; + + +//// [/src/src/folder2/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; };" + }, + "./index.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6057683066-export declare const x = 10;\r\n" + } + }, + "options": { + "composite": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +export declare const x = 10; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +exports.x = 10; + + +//// [/src/tests/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; };" + }, + "./index.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6057683066-export declare const x = 10;\r\n" + } + }, + "options": { + "composite": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js b/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js new file mode 100644 index 00000000000..82c3ffba276 --- /dev/null +++ b/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js @@ -0,0 +1,18 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b /src --verbose +12:04:00 AM - Projects in this build: + * src/src/folder/tsconfig.json + * src/src/folder2/tsconfig.json + * src/src/tsconfig.json + * src/tests/tsconfig.json + * src/tsconfig.json + +12:04:00 AM - Project 'src/src/folder/tsconfig.json' is up to date because newest input 'src/src/folder/index.ts' is older than oldest output 'src/src/folder/index.js' + +12:04:00 AM - Project 'src/src/folder2/tsconfig.json' is up to date because newest input 'src/src/folder2/index.ts' is older than oldest output 'src/src/folder2/index.js' + +12:04:00 AM - Project 'src/tests/tsconfig.json' is up to date because newest input 'src/tests/index.ts' is older than oldest output 'src/tests/index.js' + +exitCode:: 0 + + From 348735a7555145d60e4d47a0d3be8a436539fa49 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 09:00:29 -0700 Subject: [PATCH 04/16] Demo as baseline test instead --- src/testRunner/unittests/tsbuild/demo.ts | 163 ++-------- ...s-not-in-rootDir-at-the-import-location.js | 44 +++ ...ts-the-error-about-it-by-stopping-build.js | 29 ++ ...thing-setup-correctly,-reports-no-error.js | 292 ++++++++++++++++++ 4 files changed, 391 insertions(+), 137 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js create mode 100644 tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js create mode 100644 tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index c6055549485..afdf7f5d6bf 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -9,152 +9,41 @@ namespace ts { projFs = undefined!; // Release the contents }); - function coreOutputs(): string[] { - return [ - "/src/lib/core/utilities.js", - "/src/lib/core/utilities.d.ts", - "/src/lib/core/tsconfig.tsbuildinfo" - ]; - } - - function animalOutputs(): string[] { - return [ - "/src/lib/animals/animal.js", - "/src/lib/animals/animal.d.ts", - "/src/lib/animals/index.js", - "/src/lib/animals/index.d.ts", - "/src/lib/animals/dog.js", - "/src/lib/animals/dog.d.ts", - "/src/lib/animals/tsconfig.tsbuildinfo" - ]; - } - - function zooOutputs(): string[] { - return [ - "/src/lib/zoo/zoo.js", - "/src/lib/zoo/zoo.d.ts", - "/src/lib/zoo/tsconfig.tsbuildinfo" - ]; - } - - interface VerifyBuild { - modifyDiskLayout: (fs: vfs.FileSystem) => void; - expectedExitStatus: ExitStatus; - expectedDiagnostics: (fs: vfs.FileSystem) => fakes.ExpectedDiagnostic[]; - expectedOutputs: readonly string[]; - notExpectedOutputs: readonly string[]; - } - - function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - modifyDiskLayout(fs); - const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true }); - const exitStatus = builder.build(); - assert.equal(exitStatus, expectedExitStatus); - host.assertDiagnosticMessages(...expectedDiagnostics(fs)); - verifyOutputsPresent(fs, expectedOutputs); - verifyOutputsAbsent(fs, notExpectedOutputs); - } - - it("in master branch with everything setup correctly, reports no error", () => { - verifyBuild({ - modifyDiskLayout: noop, - expectedExitStatus: ExitStatus.Success, - expectedDiagnostics: () => [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/animals/tsconfig.json", "src/lib/animals/animal.js"], - [Diagnostics.Building_project_0, "/src/animals/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/zoo/tsconfig.json", "src/lib/zoo/zoo.js"], - [Diagnostics.Building_project_0, "/src/zoo/tsconfig.json"] - ], - expectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()], - notExpectedOutputs: emptyArray - }); + verifyTsc({ + scenario: "demo", + subScenario: "in master branch with everything setup correctly, reports no error", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"] }); - it("in circular branch reports the error about it by stopping build", () => { - verifyBuild({ - modifyDiskLayout: fs => replaceText( - fs, - "/src/core/tsconfig.json", - "}", - `}, + verifyTsc({ + scenario: "demo", + subScenario: "in circular branch reports the error about it by stopping build", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"], + modifyFs: fs => replaceText( + fs, + "/src/core/tsconfig.json", + "}", + `}, "references": [ { "path": "../zoo" } ]` - ), - expectedExitStatus: ExitStatus.ProjectReferenceCycle_OutputsSkipped, - expectedDiagnostics: () => [ - getExpectedDiagnosticForProjectsInBuild("src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/core/tsconfig.json", "src/tsconfig.json"), - errorDiagnostic([ - Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, - [ - "/src/tsconfig.json", - "/src/core/tsconfig.json", - "/src/zoo/tsconfig.json", - "/src/animals/tsconfig.json" - ].join("\r\n") - ]) - ], - expectedOutputs: emptyArray, - notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()] - }); + ) }); - - it("in bad-ref branch reports the error about files not in rootDir at the import location", () => { - verifyBuild({ - modifyDiskLayout: fs => prependText( - fs, - "/src/core/utilities.ts", - `import * as A from '../animals'; + verifyTsc({ + scenario: "demo", + subScenario: "in bad-ref branch reports the error about files not in rootDir at the import location", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"], + modifyFs: fs => prependText( + fs, + "/src/core/utilities.ts", + `import * as A from '../animals'; ` - ), - expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped, - expectedDiagnostics: fs => [ - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - { - message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/animal.ts", "/src/core"], - location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`), - }, - { - message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/animal.ts", "/src/core/tsconfig.json"], - location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`), - }, - { - message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/dog.ts", "/src/core"], - location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`), - }, - { - message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/dog.ts", "/src/core/tsconfig.json"], - location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`), - }, - { - message: [Diagnostics._0_is_declared_but_its_value_is_never_read, "A"], - location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `import * as A from '../animals';`), - }, - { - message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/index.ts", "/src/core"], - location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`), - }, - { - message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/index.ts", "/src/core/tsconfig.json"], - location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`), - }, - [Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/animals/tsconfig.json", "src/core"], - [Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/animals/tsconfig.json", "/src/core"], - [Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built, "src/zoo/tsconfig.json", "src/animals"], - [Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built, "/src/zoo/tsconfig.json", "/src/animals"], - ], - expectedOutputs: emptyArray, - notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()] - }); + ) }); }); } diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js new file mode 100644 index 00000000000..e9e0b3d5ee1 --- /dev/null +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js @@ -0,0 +1,44 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.json --verbose +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/animals/tsconfig.json + * src/zoo/tsconfig.json + * src/tsconfig.json + +12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/lib/core/utilities.js' does not exist + +12:00:00 AM - Building project '/src/core/tsconfig.json'... + +src/animals/index.ts(1,20): error TS6059: File '/src/animals/animal.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files. +src/animals/index.ts(1,20): error TS6307: File '/src/animals/animal.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. +src/animals/index.ts(4,32): error TS6059: File '/src/animals/dog.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files. +src/animals/index.ts(4,32): error TS6307: File '/src/animals/dog.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. +src/core/utilities.ts(1,1): error TS6133: 'A' is declared but its value is never read. +src/core/utilities.ts(1,20): error TS6059: File '/src/animals/index.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files. +src/core/utilities.ts(1,20): error TS6307: File '/src/animals/index.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. +12:00:00 AM - Project 'src/animals/tsconfig.json' can't be built because its dependency 'src/core' has errors + +12:00:00 AM - Skipping build of project '/src/animals/tsconfig.json' because its dependency '/src/core' has errors + +12:00:00 AM - Project 'src/zoo/tsconfig.json' can't be built because its dependency 'src/animals' was not built + +12:00:00 AM - Skipping build of project '/src/zoo/tsconfig.json' because its dependency '/src/animals' was not built + +exitCode:: 1 + + +//// [/src/core/utilities.ts] +import * as A from '../animals'; + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js new file mode 100644 index 00000000000..634945d60c0 --- /dev/null +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js @@ -0,0 +1,29 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.json --verbose +12:00:00 AM - Projects in this build: + * src/animals/tsconfig.json + * src/zoo/tsconfig.json + * src/core/tsconfig.json + * src/tsconfig.json + +error TS6202: Project references may not form a circular graph. Cycle detected: /src/tsconfig.json +/src/core/tsconfig.json +/src/zoo/tsconfig.json +/src/animals/tsconfig.json +exitCode:: 4 + + +//// [/src/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + }, + "references": [ + { + "path": "../zoo" + } + ] +} + diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js new file mode 100644 index 00000000000..aadb541455f --- /dev/null +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js @@ -0,0 +1,292 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.json --verbose +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/animals/tsconfig.json + * src/zoo/tsconfig.json + * src/tsconfig.json + +12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/lib/core/utilities.js' does not exist + +12:00:00 AM - Building project '/src/core/tsconfig.json'... + +12:00:00 AM - Project 'src/animals/tsconfig.json' is out of date because output file 'src/lib/animals/animal.js' does not exist + +12:00:00 AM - Building project '/src/animals/tsconfig.json'... + +12:00:00 AM - Project 'src/zoo/tsconfig.json' is out of date because output file 'src/lib/zoo/zoo.js' does not exist + +12:00:00 AM - Building project '/src/zoo/tsconfig.json'... + +exitCode:: 0 + + +//// [/src/lib/animals/animal.d.ts] +export declare type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/src/lib/animals/animal.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [/src/lib/animals/dog.d.ts] +import Animal from '.'; +export interface Dog extends Animal { + woof(): void; + name: string; +} +export declare function createDog(): Dog; + + +//// [/src/lib/animals/dog.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var utilities_1 = require("../core/utilities"); +function createDog() { + return ({ + size: "medium", + woof: function () { + console.log(this.name + " says \"Woof\"!"); + }, + name: utilities_1.makeRandomName() + }); +} +exports.createDog = createDog; + + +//// [/src/lib/animals/index.d.ts] +import Animal from './animal'; +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/src/lib/animals/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var animal_1 = require("./animal"); +var dog_1 = require("./dog"); +exports.createDog = dog_1.createDog; + + +//// [/src/lib/animals/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; };" + }, + "../../animals/animal.ts": { + "version": "-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n", + "signature": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n" + }, + "../../animals/index.ts": { + "version": "-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n", + "signature": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n" + }, + "../../core/utilities.ts": { + "version": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf(arr: T[]): T | undefined;\r\n", + "signature": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf(arr: T[]): T | undefined;\r\n" + }, + "../../animals/dog.ts": { + "version": "-10991948013-import Animal from '.';\r\nimport { makeRandomName } from '../core/utilities';\r\n\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\n\r\nexport function createDog(): Dog {\r\n return ({\r\n size: \"medium\",\r\n woof: function(this: Dog) {\r\n console.log(`${this.name} says \"Woof\"!`);\r\n },\r\n name: makeRandomName()\r\n });\r\n}\r\n\r\n", + "signature": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../animals", + "configFilePath": "../../animals/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../core/utilities.d.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/lib/core/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; };" + }, + "../../core/utilities.ts": { + "version": "25274411612-\r\nexport function makeRandomName() {\r\n return \"Bob!?! \";\r\n}\r\n\r\nexport function lastElementOf(arr: T[]): T | undefined {\r\n if (arr.length === 0) return undefined;\r\n return arr[arr.length - 1];\r\n}\r\n\r\n", + "signature": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf(arr: T[]): T | undefined;\r\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../core", + "configFilePath": "../../core/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/lib/core/utilities.d.ts] +export declare function makeRandomName(): string; +export declare function lastElementOf(arr: T[]): T | undefined; + + +//// [/src/lib/core/utilities.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function makeRandomName() { + return "Bob!?! "; +} +exports.makeRandomName = makeRandomName; +function lastElementOf(arr) { + if (arr.length === 0) + return undefined; + return arr[arr.length - 1]; +} +exports.lastElementOf = lastElementOf; + + +//// [/src/lib/zoo/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; };" + }, + "../../animals/animal.ts": { + "version": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n", + "signature": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n" + }, + "../../animals/dog.ts": { + "version": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n", + "signature": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n" + }, + "../../animals/index.ts": { + "version": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n", + "signature": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n" + }, + "../../zoo/zoo.ts": { + "version": "8797123924-import { Dog, createDog } from '../animals/index';\r\n\r\nexport function createZoo(): Array {\r\n return [\r\n createDog()\r\n ];\r\n}\r\n\r\n", + "signature": "-17433436879-import { Dog } from '../animals/index';\r\nexport declare function createZoo(): Array;\r\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../zoo", + "configFilePath": "../../zoo/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../animals/index.d.ts" + ], + "../../animals/index.ts": [ + "../animals/animal.d.ts", + "../animals/dog.d.ts" + ], + "../../zoo/zoo.ts": [ + "../animals/index.d.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../animals/index.d.ts" + ], + "../../animals/index.ts": [ + "../animals/animal.d.ts", + "../animals/dog.d.ts" + ], + "../../zoo/zoo.ts": [ + "../animals/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../zoo/zoo.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/lib/zoo/zoo.d.ts] +import { Dog } from '../animals/index'; +export declare function createZoo(): Array; + + +//// [/src/lib/zoo/zoo.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var index_1 = require("../animals/index"); +function createZoo() { + return [ + index_1.createDog() + ]; +} +exports.createZoo = createZoo; + + From c2eabddf5c70407443e6af3a464b6dc857b36592 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 09:07:20 -0700 Subject: [PATCH 05/16] Write ExitStatus as enumng-rootDir-is-in-the-tsconfig.js --- src/testRunner/unittests/tsc/helpers.ts | 2 +- .../modules-and-globals-mixed-in-amd.js | 2 +- .../multiple-emitHelpers-in-all-projects.js | 2 +- .../multiple-prologues-in-all-projects.js | 2 +- .../shebang-in-all-projects.js | 2 +- .../incremental-declaration-doesnt-change/stripInternal.js | 2 +- .../triple-slash-refs-in-all-projects.js | 2 +- .../multiple-emitHelpers-in-all-projects.js | 2 +- .../multiple-prologues-in-all-projects.js | 2 +- .../stripInternal.js | 2 +- .../initial-build/modules-and-globals-mixed-in-amd.js | 2 +- .../initial-build/multiple-emitHelpers-in-all-projects.js | 2 +- .../initial-build/multiple-prologues-in-all-projects.js | 2 +- .../amdModulesWithOut/initial-build/shebang-in-all-projects.js | 2 +- .../tsbuild/amdModulesWithOut/initial-build/stripInternal.js | 2 +- .../initial-build/triple-slash-refs-in-all-projects.js | 2 +- .../when-the-module-resolution-finds-original-source-file.js | 2 +- ...bsequent-builds-after-initial-build-doesnt-build-anything.js | 2 +- ...bsequent-builds-after-initial-build-doesnt-build-anything.js | 2 +- ...e-error-about-files-not-in-rootDir-at-the-import-location.js | 2 +- ...cular-branch-reports-the-error-about-it-by-stopping-build.js | 2 +- ...-branch-with-everything-setup-correctly,-reports-no-error.js | 2 +- ...mport-project-with-emitDeclarationOnly-and-declarationMap.js | 2 +- ...utput-in-circular-import-project-with-emitDeclarationOnly.js | 2 +- ...-in-non-circular-imports-project-with-emitDeclarationOnly.js | 2 +- ...-in-non-circular-imports-project-with-emitDeclarationOnly.js | 2 +- ...mport-project-with-emitDeclarationOnly-and-declarationMap.js | 2 +- ...utput-in-circular-import-project-with-emitDeclarationOnly.js | 2 +- ...-in-non-circular-imports-project-with-emitDeclarationOnly.js | 2 +- .../tsbuild/exitCodeOnBogusFile/initial-build/test-exit-code.js | 2 +- ...inferred-type-from-transitive-module-with-isolatedModules.js | 2 +- .../inferred-type-from-transitive-module.js | 2 +- ...iles-affected-by-change-in-signature-with-isolatedModules.js | 2 +- ...inferred-type-from-transitive-module-with-isolatedModules.js | 2 +- .../initial-build/inferred-type-from-transitive-module.js | 2 +- ...iles-affected-by-change-in-signature-with-isolatedModules.js | 2 +- ...ifies-outfile-js-projects-and-concatenates-them-correctly.js | 2 +- .../loads-js-based-projects-and-emits-them-correctly.js | 2 +- ...ojects-with-non-moved-json-files-and-emits-them-correctly.js | 2 +- ...loads-outfile-js-projects-and-concatenates-them-correctly.js | 2 +- ...ifies-outfile-js-projects-and-concatenates-them-correctly.js | 2 +- .../interface-is-merged-and-contains-late-bound-member.js | 2 +- .../interface-is-merged-and-contains-late-bound-member.js | 2 +- .../synthesized-module-specifiers-resolve-correctly.js | 2 +- .../baseline-sectioned-sourcemaps.js | 2 +- .../emitHelpers-in-all-projects.js | 2 +- .../multiple-prologues-in-all-projects.js | 2 +- .../incremental-declaration-changes/shebang-in-all-projects.js | 2 +- .../incremental-declaration-changes/strict-in-all-projects.js | 2 +- .../stripInternal-when-one-two-three-are-prepended-in-order.js | 2 +- .../incremental-declaration-changes/stripInternal.js | 2 +- .../triple-slash-refs-in-all-projects.js | 2 +- .../baseline-sectioned-sourcemaps.js | 2 +- .../emitHelpers-in-all-projects.js | 2 +- .../emitHelpers-in-only-one-dependency-project.js | 2 +- .../multiple-emitHelpers-in-all-projects.js | 2 +- .../multiple-emitHelpers-in-different-projects.js | 2 +- .../multiple-prologues-in-all-projects.js | 2 +- .../multiple-prologues-in-different-projects.js | 2 +- .../shebang-in-all-projects.js | 2 +- .../shebang-in-only-one-dependency-project.js | 2 +- .../strict-in-all-projects.js | 2 +- .../strict-in-one-dependency.js | 2 +- ...c-style-comment-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-jsdoc-style-comment.js | 2 +- ...ts-emit-enabled-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-jsdoc-style-with-comments-emit-enabled.js | 2 +- .../stripInternal-when-one-two-three-are-prepended-in-order.js | 2 +- ...ts-emit-enabled-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-with-comments-emit-enabled.js | 2 +- .../incremental-declaration-doesnt-change/stripInternal.js | 2 +- .../triple-slash-refs-in-all-projects.js | 2 +- .../triple-slash-refs-in-one-project.js | 2 +- ...inal-project-is-not-composite-but-uses-project-references.js | 2 +- .../when-source-files-are-empty-in-the-own-file.js | 2 +- .../emitHelpers-in-all-projects.js | 2 +- .../emitHelpers-in-only-one-dependency-project.js | 2 +- .../multiple-emitHelpers-in-all-projects.js | 2 +- .../multiple-emitHelpers-in-different-projects.js | 2 +- .../multiple-prologues-in-all-projects.js | 2 +- .../multiple-prologues-in-different-projects.js | 2 +- .../strict-in-all-projects.js | 2 +- .../strict-in-one-dependency.js | 2 +- ...c-style-comment-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-jsdoc-style-comment.js | 2 +- .../stripInternal-when-one-two-three-are-prepended-in-order.js | 2 +- ...ts-emit-enabled-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-with-comments-emit-enabled.js | 2 +- .../stripInternal.js | 2 +- .../initial-build/baseline-sectioned-sourcemaps.js | 2 +- .../initial-build/declarationMap-and-sourceMap-disabled.js | 2 +- .../outfile-concat/initial-build/emitHelpers-in-all-projects.js | 2 +- .../initial-build/emitHelpers-in-only-one-dependency-project.js | 2 +- .../initial-build/multiple-emitHelpers-in-all-projects.js | 2 +- .../initial-build/multiple-emitHelpers-in-different-projects.js | 2 +- .../initial-build/multiple-prologues-in-all-projects.js | 2 +- .../initial-build/multiple-prologues-in-different-projects.js | 2 +- .../outfile-concat/initial-build/shebang-in-all-projects.js | 2 +- .../initial-build/shebang-in-only-one-dependency-project.js | 2 +- .../outfile-concat/initial-build/strict-in-all-projects.js | 2 +- .../outfile-concat/initial-build/strict-in-one-dependency.js | 2 +- ...nternal-baseline-when-internal-is-inside-another-internal.js | 2 +- ...c-style-comment-when-one-two-three-are-prepended-in-order.js | 2 +- .../initial-build/stripInternal-jsdoc-style-comment.js | 2 +- ...ts-emit-enabled-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-jsdoc-style-with-comments-emit-enabled.js | 2 +- .../stripInternal-when-few-members-of-enum-are-internal.js | 2 +- .../stripInternal-when-one-two-three-are-prepended-in-order.js | 2 +- .../stripInternal-when-prepend-is-completely-internal.js | 2 +- ...ts-emit-enabled-when-one-two-three-are-prepended-in-order.js | 2 +- .../initial-build/stripInternal-with-comments-emit-enabled.js | 2 +- .../tsbuild/outfile-concat/initial-build/stripInternal.js | 2 +- .../initial-build/triple-slash-refs-in-all-projects.js | 2 +- .../initial-build/triple-slash-refs-in-one-project.js | 2 +- .../when-final-project-is-not-composite-but-incremental.js | 2 +- ...inal-project-is-not-composite-but-uses-project-references.js | 2 +- .../when-final-project-specifies-tsBuildInfoFile.js | 2 +- .../when-source-files-are-empty-in-the-own-file.js | 2 +- .../tsbuild/sample1/incremental-declaration-changes/sample.js | 2 +- .../when-declaration-option-changes.js | 2 +- .../when-esModuleInterop-option-changes.js | 2 +- .../when-logic-config-changes-declaration-dir.js | 2 +- .../when-module-option-changes.js | 2 +- .../when-target-option-changes.js | 2 +- .../sample1/incremental-declaration-doesnt-change/sample.js | 2 +- .../baselines/reference/tsbuild/sample1/initial-build/sample.js | 2 +- .../sample1/initial-build/when-declaration-option-changes.js | 2 +- .../initial-build/when-esModuleInterop-option-changes.js | 2 +- .../initial-build/when-logic-specifies-tsBuildInfoFile.js | 2 +- .../tsbuild/sample1/initial-build/when-module-option-changes.js | 2 +- .../tsbuild/sample1/initial-build/when-target-option-changes.js | 2 +- ...n-pkg-references-sibling-package-through-indirect-symlink.js | 2 +- ...s-referenced-through-source-and-another-symlinked-package.js | 2 +- .../when-passing-filename-for-buildinfo-on-commandline.js | 2 +- .../initial-build/when-passing-rootDir-from-commandline.js | 2 +- .../when-passing-filename-for-buildinfo-on-commandline.js | 2 +- .../no-change-run/when-passing-rootDir-from-commandline.js | 2 +- 137 files changed, 137 insertions(+), 137 deletions(-) diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 85eb2a886e0..80a14705390 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -222,7 +222,7 @@ namespace ts { sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`); sys.exit = exitCode => sys.exitCode = exitCode; executeCommandLine(sys, commandLineArgs); - sys.write(`exitCode:: ${sys.exitCode}\n`); + sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`); if (baselineReadFileCalls) { sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); } diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js index 156e26088e0..f7e72a97df5 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/modules-and-globals-mixed-in-amd.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js index e09e87242a1..a8031f00754 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js index 93a7cbf7326..20b15b4d880 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js index e3daf15bcac..8edcec79d8b 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/shebang-in-all-projects.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js index 375dd743926..36435d0421c 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/stripInternal.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js index b07879caae0..de9f9dc4ac5 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js @@ -14,7 +14,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js index 27bdfed7421..fe117cffae0 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js @@ -14,7 +14,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.js] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js index ae8b69e86b9..3d7c28a3a28 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js @@ -14,7 +14,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js index e371045db9a..455d2e78174 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/incremental-headers-change-without-dts-changes/stripInternal.js @@ -12,7 +12,7 @@ 12:08:00 AM - Updating output of project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.d.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js index 1e6b3c5f9d3..dbe3eaffbde 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/modules-and-globals-mixed-in-amd.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.d.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js index 4bef255a862..a2965cde2de 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-emitHelpers-in-all-projects.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/file3.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js index 0a28b0c5003..ce52dcebd47 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/multiple-prologues-in-all-projects.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/file3.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js index 16c2c89eab9..ac259989bce 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/shebang-in-all-projects.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/file3.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js index 6192e04a062..04bdb8e9b46 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/stripInternal.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/module.d.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js index 50259e2c93d..3aab51c08f7 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/triple-slash-refs-in-all-projects.js @@ -12,7 +12,7 @@ 12:01:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/file4.ts] diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js index 9bc7340630f..1ddbd2fff9a 100644 --- a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-build/when-the-module-resolution-finds-original-source-file.js @@ -12,7 +12,7 @@ 12:00:00 AM - Building project '/src/app/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/app/file3.ts] diff --git a/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js b/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js index b6b8aee9bec..d0dedc6b9c1 100644 --- a/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js +++ b/tests/baselines/reference/tsbuild/containerOnlyReferenced/initial-build/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js @@ -19,7 +19,7 @@ 12:01:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/src/folder/index.d.ts] diff --git a/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js b/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js index 82c3ffba276..d47940ed3e2 100644 --- a/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js +++ b/tests/baselines/reference/tsbuild/containerOnlyReferenced/no-change-run/verify-that-subsequent-builds-after-initial-build-doesnt-build-anything.js @@ -13,6 +13,6 @@ 12:04:00 AM - Project 'src/tests/tsconfig.json' is up to date because newest input 'src/tests/index.ts' is older than oldest output 'src/tests/index.js' -exitCode:: 0 +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js index e9e0b3d5ee1..bcc933cdbdb 100644 --- a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js @@ -25,7 +25,7 @@ src/core/utilities.ts(1,20): error TS6307: File '/src/animals/index.ts' is not l 12:00:00 AM - Skipping build of project '/src/zoo/tsconfig.json' because its dependency '/src/animals' was not built -exitCode:: 1 +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped //// [/src/core/utilities.ts] diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js index 634945d60c0..c7376c362e7 100644 --- a/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-circular-branch-reports-the-error-about-it-by-stopping-build.js @@ -10,7 +10,7 @@ error TS6202: Project references may not form a circular graph. Cycle detected: /src/core/tsconfig.json /src/zoo/tsconfig.json /src/animals/tsconfig.json -exitCode:: 4 +exitCode:: ExitStatus.ProjectReferenceCycle_OutputsSkupped //// [/src/core/tsconfig.json] diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js index aadb541455f..f5b45ed2587 100644 --- a/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js @@ -18,7 +18,7 @@ 12:00:00 AM - Building project '/src/zoo/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/animals/animal.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js index d2d70c1b8be..41f2beaa281 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -7,7 +7,7 @@ 12:04:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js index 6e6f2bb1805..747e3ee3a36 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -7,7 +7,7 @@ 12:04:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index 8bcb33bced7..3ce9402fb24 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -7,7 +7,7 @@ 12:04:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index bdfcb1e826f..1ab42631bc3 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -9,7 +9,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js index 38d8974e900..6acd9f13604 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js index 6f2bc263212..b854647cbed 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js index aabaf41d53b..679a7c01703 100644 --- a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/a.d.ts] diff --git a/tests/baselines/reference/tsbuild/exitCodeOnBogusFile/initial-build/test-exit-code.js b/tests/baselines/reference/tsbuild/exitCodeOnBogusFile/initial-build/test-exit-code.js index 5009763f757..eb94c8cd71c 100644 --- a/tests/baselines/reference/tsbuild/exitCodeOnBogusFile/initial-build/test-exit-code.js +++ b/tests/baselines/reference/tsbuild/exitCodeOnBogusFile/initial-build/test-exit-code.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc -b bogus.json error TS6053: File '/bogus.json' not found. -exitCode:: 1 +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js index a95215cf77f..bfe04451775 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module-with-isolatedModules.js @@ -9,7 +9,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/bar.ts] diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js index 5cd9097a200..4e7610dc52f 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js @@ -9,7 +9,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/bar.ts] diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js index a00425b57a8..2462f65292e 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -8,7 +8,7 @@ 12:04:00 AM - Building project '/src/tsconfig.json'... src/lazyIndex.ts(4,5): error TS2554: Expected 0 arguments, but got 1. -exitCode:: 1 +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped //// [/src/bar.ts] diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js index 93a7e296495..4d98599a17f 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module-with-isolatedModules.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/obj/bar.d.ts] diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js index 45a284dc09c..584c54a32c9 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/inferred-type-from-transitive-module.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/obj/bar.d.ts] diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js index 39ad2d40a31..4835be06a9e 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lazyIndex.ts] diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/incremental-declaration-doesnt-change/modifies-outfile-js-projects-and-concatenates-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/incremental-declaration-doesnt-change/modifies-outfile-js-projects-and-concatenates-them-correctly.js index b863d923b66..22e8a88b84e 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/incremental-declaration-doesnt-change/modifies-outfile-js-projects-and-concatenates-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/incremental-declaration-doesnt-change/modifies-outfile-js-projects-and-concatenates-them-correctly.js @@ -1,6 +1,6 @@ //// [/lib/incremental-declaration-doesnt-changeOutput.txt] /lib/tsc -b /src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/sub-project/index.js] diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js index 2abc5b9119b..7417b51952a 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js @@ -47,7 +47,7 @@ module.exports = {}; //// [/lib/initial-buildOutput.txt] /lib/tsc -b /src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/lib/sub-project/index.d.ts] diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js index 42b47203406..3c49c99688d 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc -b /src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/out/sub-project/index.d.ts] diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-outfile-js-projects-and-concatenates-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-outfile-js-projects-and-concatenates-them-correctly.js index c46f5e3baa1..769da514d2e 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-outfile-js-projects-and-concatenates-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-outfile-js-projects-and-concatenates-them-correctly.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc -b /src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/common/common.d.ts] diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/modifies-outfile-js-projects-and-concatenates-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/modifies-outfile-js-projects-and-concatenates-them-correctly.js index c46f5e3baa1..769da514d2e 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/modifies-outfile-js-projects-and-concatenates-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/modifies-outfile-js-projects-and-concatenates-them-correctly.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc -b /src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/common/common.d.ts] diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js index ffa834ba467..1cdbffe6cc6 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js @@ -9,7 +9,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/src/main.js] diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js index 86d36097454..d89b3a9c894 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-build/interface-is-merged-and-contains-late-bound-member.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/src/hkt.js] diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js index fb5eae55d7c..5c8f8da7b6f 100644 --- a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js +++ b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/synthesized-module-specifiers-resolve-correctly.js @@ -19,7 +19,7 @@ 12:00:00 AM - Building project '/src/solution/sub-project-2/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/lib/solution/common/nominal.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js index 136509b59b8..e5d4f35c93f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/baseline-sectioned-sourcemaps.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js index 605e02ffcc8..5b05d6cff8c 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/emitHelpers-in-all-projects.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js index a10f26edcc3..c8a9d53d874 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/multiple-prologues-in-all-projects.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js index 874c818de64..68482354748 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/shebang-in-all-projects.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js index 9d7471bf95c..009e53ddc3a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/strict-in-all-projects.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js index cca89f269e9..2c15d3a563a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -17,7 +17,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/second/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js index 397f586217e..a40c29ef70c 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/stripInternal.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js index 25cb88e8ddc..e8896f24c61 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/triple-slash-refs-in-all-projects.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js index e0b14d9a65d..a805c14be90 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/baseline-sectioned-sourcemaps.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js index cb0c5eb2bc6..f841221d940 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js index 11497868243..c9238840812 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/emitHelpers-in-only-one-dependency-project.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js index d8e06c669bc..468e4b45ad6 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js index 692390e1645..838cd926887 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-emitHelpers-in-different-projects.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js index 30075f17e26..6ed01121bcf 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js index ba51e272d7e..8e36508f65b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/multiple-prologues-in-different-projects.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js index bbddaba06ea..1a06d37841a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js index 8cbabe3c880..38ad3648800 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/shebang-in-only-one-dependency-project.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js index a97bd2a2197..f5d6f6035f4 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js index 9bdfad323e9..b1068d14dd8 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/strict-in-one-dependency.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index ac11658e2ca..18b93f1463d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.js] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js index 48790653874..23b7fc027ca 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-comment.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 957ed1cd9b1..3f048c5515b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.js] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js index beb8d35124e..c68c0d44e93 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-jsdoc-style-with-comments-emit-enabled.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js index 512c530ffff..a5c99ef2c31 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/second/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 1eed13c8342..590b1a33f1a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.js] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js index 51479fbc65d..7e73dc4308f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal-with-comments-emit-enabled.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js index 4a70c73124e..e8947998db3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/stripInternal.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js index b11dc0218e2..285c570630d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js index 8d9f639e805..1beaaa4d915 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/triple-slash-refs-in-one-project.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js index 66e8fed0677..71052c4b610 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-final-project-is-not-composite-but-uses-project-references.js @@ -15,7 +15,7 @@ 12:04:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js index c41ea2edc69..9df84107d04 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/when-source-files-are-empty-in-the-own-file.js @@ -17,7 +17,7 @@ 12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js index 971adc119ac..8a95a54f99a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js index 4224fc07853..aa9240a62a7 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/emitHelpers-in-only-one-dependency-project.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js index 88807139890..d6dded28089 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js index 2c4350cc261..2185893e4cb 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-emitHelpers-in-different-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js index b7da2a1ff96..f1ed7eceec2 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-all-projects.js @@ -17,7 +17,7 @@ 12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js index 7b9dc11ca9b..0813221bc46 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/multiple-prologues-in-different-projects.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js index f762fa7ac29..43be2024501 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-all-projects.js @@ -17,7 +17,7 @@ 12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js index 0e8a092a7d1..5742487e7bf 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/strict-in-one-dependency.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index d1aac8b70e8..87742bb7bdf 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js index 44b2e3afe3f..dc7b21b3dea 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-jsdoc-style-comment.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js index 1fec0b7b22e..2862e36ee86 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/second/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 774cd39ea59..972fd46db7d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -21,7 +21,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js index a4a3c13a5f4..99486e27c0a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal-with-comments-emit-enabled.js @@ -17,7 +17,7 @@ 12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js index a048c6ecd75..280f291e8ad 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-headers-change-without-dts-changes/stripInternal.js @@ -17,7 +17,7 @@ 12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js index 2b217d8a1d1..bd3389dfbc3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/baseline-sectioned-sourcemaps.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js index 41e8f94b4aa..f5ade132423 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/declarationMap-and-sourceMap-disabled.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js index 7dbec0f66cf..0aa82f67719 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js index b946940addd..5418a2999e9 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/emitHelpers-in-only-one-dependency-project.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js index 242690d2885..4f45dea3525 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js index 93ba9fcc3e3..fa74878263c 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js index 21f8943ae6b..3384786dff3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js index ea725d85d49..739026ac55a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/multiple-prologues-in-different-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js index b8adefd8976..dcf2a348406 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js index bab82334961..2544423aa9a 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/shebang-in-only-one-dependency-project.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js index 1471bdb3090..e09acc6c682 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js index 8a4cce33dfc..d959c28bc6b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/strict-in-one-dependency.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js index 5595b32ed57..5c650827310 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-baseline-when-internal-is-inside-another-internal.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js index 339374d5326..b6a9dac9f4b 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment-when-one-two-three-are-prepended-in-order.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js index 329530576c0..34b42935b4f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-comment.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index 27a636b0f7c..1d167197b09 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js index ae47b924825..f55627f1e1f 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-jsdoc-style-with-comments-emit-enabled.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js index 91cf996eddd..ac4b4506e9c 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-few-members-of-enum-are-internal.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js index 360d2c392a2..33043052625 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-one-two-three-are-prepended-in-order.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/second/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-prepend-is-completely-internal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-prepend-is-completely-internal.js index a20e6dadee5..1acbd84075d 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-prepend-is-completely-internal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-when-prepend-is-completely-internal.js @@ -12,7 +12,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/first/bin/first-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js index b9106767cea..fb179a1c7a3 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled-when-one-two-three-are-prepended-in-order.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js index 80e0f71cc55..e6ce5a30667 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal-with-comments-emit-enabled.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js index 467077d6a66..064e40bdfc9 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/stripInternal.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js index c8efbd205e6..c0f287ba863 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-all-projects.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/third/tsconfig.json": 1, "/src/first/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js index 471309f35f0..d2396185240 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/triple-slash-refs-in-one-project.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js index 81bec95d4f6..3072958e47c 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-incremental.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js index 2e7b1f1663f..936365084f5 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-is-not-composite-but-uses-project-references.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js index b0131b6af56..67d83cd6365 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-final-project-specifies-tsBuildInfoFile.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js index deb7dbd86e6..40ff6cf19a1 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/when-source-files-are-empty-in-the-own-file.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/third/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/2/second-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js index 94a962ebe02..0796602e3f9 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js @@ -19,7 +19,7 @@ 12:04:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/tests/tsconfig.json": 1, "/src/core/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js index 2311e64ef2b..529acb4d78a 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js @@ -7,7 +7,7 @@ 12:04:00 AM - Building project '/src/core/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.d.ts] diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js index dd48841c8af..70113328193 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js @@ -13,7 +13,7 @@ 12:04:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/tests/index.d.ts] file written with same contents diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js index da943e101e2..275c807f66f 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js @@ -15,7 +15,7 @@ 12:12:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/tests/tsconfig.json": 1, "/src/core/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js index 0a801843705..03b378879dc 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js @@ -7,7 +7,7 @@ 12:04:00 AM - Building project '/src/core/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.js] diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js index bc3a7921993..b28623d38ed 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js @@ -15,7 +15,7 @@ TSFILE: /src/core/tsconfig.tsbuildinfo /src/core/anotherModule.ts /src/core/index.ts /src/core/some_decl.d.ts -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.js] diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js index a2d9e5a8564..04b80d55cbc 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js @@ -19,7 +19,7 @@ 12:08:00 AM - Updating output timestamps of project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/tests/tsconfig.json": 1, "/src/core/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js index 00228056483..6dec9d74cd3 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/tests/tsconfig.json": 1, "/src/core/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js index 6fcba548d3b..6973a1605d1 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-declaration-option-changes.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/core/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.js] diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js index 0f1ea65c5e4..5a11e363bfd 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-esModuleInterop-option-changes.js @@ -17,7 +17,7 @@ 12:01:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.d.ts] diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js index fe60d8093d4..a448bcf3054 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-logic-specifies-tsBuildInfoFile.js @@ -17,7 +17,7 @@ 12:00:00 AM - Building project '/src/tests/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success readFiles:: { "/src/tests/tsconfig.json": 1, "/src/core/tsconfig.json": 1, diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js index c890f0d5766..d4692e872c2 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-module-option-changes.js @@ -7,7 +7,7 @@ 12:01:00 AM - Building project '/src/core/tsconfig.json'... -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/core/anotherModule.js] diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js index c615f77eb86..fcbcb2bbcb6 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/when-target-option-changes.js @@ -15,7 +15,7 @@ TSFILE: /src/core/tsconfig.tsbuildinfo /src/core/anotherModule.ts /src/core/index.ts /src/core/some_decl.d.ts -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/lib/lib.d.ts] diff --git a/tests/baselines/reference/tsc/declarationEmit/initial-build/when-pkg-references-sibling-package-through-indirect-symlink.js b/tests/baselines/reference/tsc/declarationEmit/initial-build/when-pkg-references-sibling-package-through-indirect-symlink.js index 42cb6cf78c8..4e98729a388 100644 --- a/tests/baselines/reference/tsc/declarationEmit/initial-build/when-pkg-references-sibling-package-through-indirect-symlink.js +++ b/tests/baselines/reference/tsc/declarationEmit/initial-build/when-pkg-references-sibling-package-through-indirect-symlink.js @@ -8,7 +8,7 @@ src/pkg3/src/keys.ts(2,14): error TS2742: The inferred type of 'ADMIN' cannot be /src/pkg3/node_modules/@raymondfeng/pkg2/dist/index.d.ts /src/pkg3/src/keys.ts /src/pkg3/src/index.ts -exitCode:: 1 +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped //// [/src/pkg3/dist/index.d.ts] diff --git a/tests/baselines/reference/tsc/declarationEmit/initial-build/when-same-version-is-referenced-through-source-and-another-symlinked-package.js b/tests/baselines/reference/tsc/declarationEmit/initial-build/when-same-version-is-referenced-through-source-and-another-symlinked-package.js index a0737ae1203..e634d99e523 100644 --- a/tests/baselines/reference/tsc/declarationEmit/initial-build/when-same-version-is-referenced-through-source-and-another-symlinked-package.js +++ b/tests/baselines/reference/tsc/declarationEmit/initial-build/when-same-version-is-referenced-through-source-and-another-symlinked-package.js @@ -6,7 +6,7 @@ /src/plugin-one/node_modules/plugin-two/node_modules/typescript-fsa/index.d.ts /src/plugin-one/node_modules/plugin-two/index.d.ts /src/plugin-one/index.ts -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/plugin-one/action.d.ts] diff --git a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js index 54af1ef615c..b7b2d955768 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/project/.tsbuildinfo] diff --git a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-rootDir-from-commandline.js b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-rootDir-from-commandline.js index 06a57659b5b..6c1bdf45329 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-rootDir-from-commandline.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-rootDir-from-commandline.js @@ -1,6 +1,6 @@ //// [/lib/initial-buildOutput.txt] /lib/tsc --p src/project --rootDir src/project/src -exitCode:: 0 +exitCode:: ExitStatus.Success //// [/src/project/dist/main.js] diff --git a/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js index 5ebc3de7b42..b8bd5ebd76a 100644 --- a/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js +++ b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-filename-for-buildinfo-on-commandline.js @@ -1,5 +1,5 @@ //// [/lib/no-change-runOutput.txt] /lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo -exitCode:: 0 +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js index a20c3d3f615..8c858da7594 100644 --- a/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js +++ b/tests/baselines/reference/tsc/incremental/no-change-run/when-passing-rootDir-from-commandline.js @@ -1,5 +1,5 @@ //// [/lib/no-change-runOutput.txt] /lib/tsc --p src/project --rootDir src/project/src -exitCode:: 0 +exitCode:: ExitStatus.Success From 7c0cc4a3b957848d7492a957f1baa59d8ba7a189 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 09:15:40 -0700 Subject: [PATCH 06/16] empty files to baseline test --- .../unittests/tsbuild/emptyFiles.ts | 49 +++++++------------ ...es-is-empty-and-references-are-provided.js | 6 +++ ...is-empty-and-no-references-are-provided.js | 49 +++++++++++++++++++ 3 files changed, 72 insertions(+), 32 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js create mode 100644 tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index 6e09b5871f9..9740893bdb6 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -1,40 +1,25 @@ namespace ts { - const projFs = loadProjectFromDisk("tests/projects/empty-files"); - - const allExpectedOutputs = [ - "/src/core/index.js", - "/src/core/index.d.ts", - "/src/core/index.d.ts.map", - ]; - describe("unittests:: tsbuild - empty files option in tsconfig", () => { - it("has empty files diagnostic when files is empty and no references are provided", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/no-references"], { dry: false, force: false, verbose: false }); - - host.clearDiagnostics(); - builder.build(); - host.assertDiagnosticMessages({ - message: [Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"], - location: expectedLocationLastIndexOf(fs, "/src/no-references/tsconfig.json", "[]"), - }); - - // Check for outputs to not be written. - verifyOutputsAbsent(fs, allExpectedOutputs); + let projFs: vfs.FileSystem; + before(() => { + projFs = loadProjectFromDisk("tests/projects/empty-files"); + }); + after(() => { + projFs = undefined!; }); - it("does not have empty files diagnostic when files is empty and references are provided", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/with-references"], { dry: false, force: false, verbose: false }); + verifyTsc({ + scenario: "emptyFiles", + subScenario: "does not have empty files diagnostic when files is empty and references are provided", + fs: () => projFs, + commandLineArgs: ["--b", "/src/no-references"], + }); - host.clearDiagnostics(); - builder.build(); - host.assertDiagnosticMessages(/*empty*/); - - // Check for outputs to be written. - verifyOutputsPresent(fs, allExpectedOutputs); + verifyTsc({ + scenario: "emptyFiles", + subScenario: "has empty files diagnostic when files is empty and no references are provided", + fs: () => projFs, + commandLineArgs: ["--b", "/src/with-references"], }); }); } diff --git a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js new file mode 100644 index 00000000000..6db6e8fe608 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js @@ -0,0 +1,6 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/no-references +src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + diff --git a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js new file mode 100644 index 00000000000..8760280f3de --- /dev/null +++ b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js @@ -0,0 +1,49 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/with-references +exitCode:: ExitStatus.Success + + +//// [/src/core/index.d.ts] +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./index.ts": { + "version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + From e3cc4f4730f64e2ddc36bfdf216d9f95884f5a7c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 09:19:49 -0700 Subject: [PATCH 07/16] missingExtendedConfig to baseline test --- .../unittests/tsbuild/missingExtendedFile.ts | 24 +++++++++---------- .../when-tsconfig-extends-the-missing-file.js | 9 +++++++ 2 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/missingExtendedConfig/initial-build/when-tsconfig-extends-the-missing-file.js diff --git a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts index 7fa3352da26..398b38fdbea 100644 --- a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts +++ b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts @@ -1,17 +1,17 @@ namespace ts { describe("unittests:: tsbuild:: when tsconfig extends the missing file", () => { - it("unittests:: tsbuild - when tsconfig extends the missing file", () => { - const projFs = loadProjectFromDisk("tests/projects/missingExtendedConfig"); - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], {}); - builder.build(); - host.assertDiagnosticMessages( - errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]), - errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.first.json", "[\"**/*\"]", "[]"]), - errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]), - errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.second.json", "[\"**/*\"]", "[]"]) - ); + let projFs: vfs.FileSystem; + before(() => { + projFs = loadProjectFromDisk("tests/projects/missingExtendedConfig"); + }); + after(() => { + projFs = undefined!; + }); + verifyTsc({ + scenario: "missingExtendedConfig", + subScenario: "when tsconfig extends the missing file", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.json"], }); }); } diff --git a/tests/baselines/reference/tsbuild/missingExtendedConfig/initial-build/when-tsconfig-extends-the-missing-file.js b/tests/baselines/reference/tsbuild/missingExtendedConfig/initial-build/when-tsconfig-extends-the-missing-file.js new file mode 100644 index 00000000000..1221147bc8e --- /dev/null +++ b/tests/baselines/reference/tsbuild/missingExtendedConfig/initial-build/when-tsconfig-extends-the-missing-file.js @@ -0,0 +1,9 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.json +error TS5058: The specified path does not exist: '/src/foobar.json'. +error TS18003: No inputs were found in config file '/src/tsconfig.first.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'. +error TS5058: The specified path does not exist: '/src/foobar.json'. +error TS18003: No inputs were found in config file '/src/tsconfig.second.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + From 25db0b0bf06ead2501778558611f7b273890d2b1 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 11:20:14 -0700 Subject: [PATCH 08/16] Merge baselining and tsc logic into one --- src/compiler/commandLineParser.ts | 138 +---- src/compiler/watch.ts | 2 +- src/testRunner/tsconfig.json | 1 + src/testRunner/unittests/tsc/helpers.ts | 172 +----- src/tsc/executeCommandLine.ts | 725 ++++++++++++++++++++++++ src/tsc/tsc.ts | 461 +-------------- src/tsc/tsconfig.json | 1 + 7 files changed, 765 insertions(+), 735 deletions(-) create mode 100644 src/tsc/executeCommandLine.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 596f8651500..e4c30cdabe8 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1227,7 +1227,7 @@ namespace ts { } /*@internal*/ - export function parseBuildCommand(args: string[]): ParsedBuildCommand { + export function parseBuildCommand(args: readonly string[]): ParsedBuildCommand { let buildOptionNameMap: OptionNameMap | undefined; const returnBuildOptionNameMap = () => (buildOptionNameMap || (buildOptionNameMap = createOptionNameMap(buildOpts))); const { options, fileNames: projects, errors } = parseCommandLineWorker(returnBuildOptionNameMap, [ @@ -1258,125 +1258,12 @@ namespace ts { return { buildOptions, projects, errors }; } - function getDiagnosticText(_message: DiagnosticMessage, ..._args: any[]): string { + /* @internal */ + export function getDiagnosticText(_message: DiagnosticMessage, ..._args: any[]): string { const diagnostic = createCompilerDiagnostic.apply(undefined, arguments); return diagnostic.messageText; } - /* @internal */ - export function printVersion() { - sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine); - } - - /* @internal */ - export function printHelp(optionsList: readonly CommandLineOption[], syntaxPrefix = "") { - const output: string[] = []; - - // We want to align our "syntax" and "examples" commands to a certain margin. - const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length; - const examplesLength = getDiagnosticText(Diagnostics.Examples_Colon_0, "").length; - let marginLength = Math.max(syntaxLength, examplesLength); - - // Build up the syntactic skeleton. - let syntax = makePadding(marginLength - syntaxLength); - syntax += `tsc ${syntaxPrefix}[${getDiagnosticText(Diagnostics.options)}] [${getDiagnosticText(Diagnostics.file)}...]`; - - output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax)); - output.push(sys.newLine + sys.newLine); - - // Build up the list of examples. - const padding = makePadding(marginLength); - output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine); - output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine); - output.push(padding + "tsc @args.txt" + sys.newLine); - output.push(padding + "tsc --build tsconfig.json" + sys.newLine); - output.push(sys.newLine); - - output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine); - - // We want our descriptions to align at the same column in our output, - // so we keep track of the longest option usage string. - marginLength = 0; - const usageColumn: string[] = []; // Things like "-d, --declaration" go in here. - const descriptionColumn: string[] = []; - - const optionsDescriptionMap = createMap(); // Map between option.description and list of option.type if it is a kind - - for (const option of optionsList) { - // If an option lacks a description, - // it is not officially supported. - if (!option.description) { - continue; - } - - let usageText = " "; - if (option.shortName) { - usageText += "-" + option.shortName; - usageText += getParamType(option); - usageText += ", "; - } - - usageText += "--" + option.name; - usageText += getParamType(option); - - usageColumn.push(usageText); - let description: string; - - if (option.name === "lib") { - description = getDiagnosticText(option.description); - const element = (option).element; - const typeMap = >element.type; - optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`)); - } - else { - description = getDiagnosticText(option.description); - } - - descriptionColumn.push(description); - - // Set the new margin for the description column if necessary. - marginLength = Math.max(usageText.length, marginLength); - } - - // Special case that can't fit in the loop. - const usageText = " @<" + getDiagnosticText(Diagnostics.file) + ">"; - usageColumn.push(usageText); - descriptionColumn.push(getDiagnosticText(Diagnostics.Insert_command_line_options_and_files_from_a_file)); - marginLength = Math.max(usageText.length, marginLength); - - // Print out each row, aligning all the descriptions on the same column. - for (let i = 0; i < usageColumn.length; i++) { - const usage = usageColumn[i]; - const description = descriptionColumn[i]; - const kindsList = optionsDescriptionMap.get(description); - output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine); - - if (kindsList) { - output.push(makePadding(marginLength + 4)); - for (const kind of kindsList) { - output.push(kind + " "); - } - output.push(sys.newLine); - } - } - - for (const line of output) { - sys.write(line); - } - return; - - function getParamType(option: CommandLineOption) { - if (option.paramType !== undefined) { - return " " + getDiagnosticText(option.paramType); - } - return ""; - } - - function makePadding(paddingLength: number): string { - return Array(paddingLength + 1).join(" "); - } - } - export type DiagnosticReporter = (diagnostic: Diagnostic) => void; /** * Reports config file diagnostics @@ -1801,6 +1688,12 @@ namespace ts { references: readonly ProjectReference[] | undefined; } + /** @internal */ + export interface ConvertToTSConfigHost { + getCurrentDirectory(): string; + useCaseSensitiveFileNames: boolean; + } + /** * Generate an uncommented, complete tsconfig for use with "--showConfig" * @param configParseResult options to be generated into tsconfig.json @@ -1808,7 +1701,7 @@ namespace ts { * @param host provides current directory and case sensitivity services */ /** @internal */ - export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): TSConfig { + export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: ConvertToTSConfigHost): TSConfig { const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const files = map( filter( @@ -1816,7 +1709,8 @@ namespace ts { (!configParseResult.configFileSpecs || !configParseResult.configFileSpecs.validatedIncludeSpecs) ? _ => true : matchesSpecs( configFileName, configParseResult.configFileSpecs.validatedIncludeSpecs, - configParseResult.configFileSpecs.validatedExcludeSpecs + configParseResult.configFileSpecs.validatedExcludeSpecs, + host, ) ), f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName) @@ -1854,11 +1748,11 @@ namespace ts { return specs; } - function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined, excludeSpecs: readonly string[] | undefined): (path: string) => boolean { + function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined, excludeSpecs: readonly string[] | undefined, host: ConvertToTSConfigHost): (path: string) => boolean { if (!includeSpecs) return _ => true; - const patterns = getFileMatcherPatterns(path, excludeSpecs, includeSpecs, sys.useCaseSensitiveFileNames, sys.getCurrentDirectory()); - const excludeRe = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, sys.useCaseSensitiveFileNames); - const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, sys.useCaseSensitiveFileNames); + const patterns = getFileMatcherPatterns(path, excludeSpecs, includeSpecs, host.useCaseSensitiveFileNames, host.getCurrentDirectory()); + const excludeRe = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, host.useCaseSensitiveFileNames); + const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames); if (includeRe) { if (excludeRe) { return path => !(includeRe.test(path) && !excludeRe.test(path)); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 06871fc9cac..cac3f3009b1 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -91,7 +91,7 @@ namespace ts { /** Parses config file using System interface */ export function parseConfigFileWithSystem(configFileName: string, optionsToExtend: CompilerOptions, system: System, reportDiagnostic: DiagnosticReporter) { const host: ParseConfigFileHost = system; - host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(sys, reportDiagnostic, diagnostic); + host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host); host.onUnRecoverableConfigFileDiagnostic = undefined!; // TODO: GH#18217 return result; diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 6eec3a90221..15beae61f25 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -39,6 +39,7 @@ "unittests/services/extract/helpers.ts", "unittests/tsbuild/helpers.ts", + "../tsc/executeCommandLine.ts", "unittests/tsc/helpers.ts", "unittests/tscWatch/helpers.ts", "unittests/tsserver/helpers.ts", diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 80a14705390..6de4a4f08b6 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -3,167 +3,6 @@ namespace ts { writtenFiles: Map; baseLine(): void; }; - function executeCommandLine(sys: TscCompileSystem, commandLineArgs: readonly string[]) { - if (isBuild(commandLineArgs)) { - return performBuild(sys, commandLineArgs.slice(1)); - } - - const reportDiagnostic = createDiagnosticReporter(sys); - const commandLine = parseCommandLine(commandLineArgs, path => sys.readFile(path)); - if (commandLine.options.build) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - if (commandLine.errors.length > 0) { - commandLine.errors.forEach(reportDiagnostic); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - let configFileName: string | undefined; - if (commandLine.options.project) { - if (commandLine.fileNames.length !== 0) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - const fileOrDirectory = normalizePath(commandLine.options.project); - if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) { - configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); - if (!sys.fileExists(configFileName)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - } - else { - configFileName = fileOrDirectory; - if (!sys.fileExists(configFileName)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - } - } - else if (commandLine.fileNames.length === 0) { - const searchPath = normalizePath(sys.getCurrentDirectory()); - configFileName = findConfigFile(searchPath, sys.fileExists); - } - - Debug.assert(commandLine.fileNames.length !== 0 || !!configFileName); - - const currentDirectory = sys.getCurrentDirectory(); - const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames); - const commandLineOptions = convertToOptionsWithAbsolutePaths( - commandLine.options, - fileName => toPath(fileName, currentDirectory, getCanonicalFileName) - ); - - if (configFileName) { - const configParseResult = Debug.assertDefined(parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)); - if (isIncrementalCompilation(configParseResult.options)) { - performIncrementalCompilation(sys, configParseResult); - } - else { - performCompilation(sys, configParseResult); - } - } - else { - if (isIncrementalCompilation(commandLine.options)) { - performIncrementalCompilation(sys, { - ...commandLine, - options: commandLineOptions - }); - } - else { - performCompilation(sys, { - ...commandLine, - options: commandLineOptions - }); - } - } - } - - function createReportErrorSummary(sys: TscCompileSystem, options: CompilerOptions): ReportEmitErrorSummary | undefined { - return options.pretty ? - errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) : - undefined; - } - - function performCompilation(sys: TscCompileSystem, config: ParsedCommandLine) { - const { fileNames, options, projectReferences } = config; - const reportDiagnostic = createDiagnosticReporter(sys, options.pretty); - const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys); - fakes.patchHostForBuildInfoReadWrite(host); - const currentDirectory = host.getCurrentDirectory(); - const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); - changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); - const program = createProgram({ - rootNames: fileNames, - options, - projectReferences, - host, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config) - }); - const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( - program, - reportDiagnostic, - s => sys.write(s + sys.newLine), - createReportErrorSummary(sys, options) - ); - baselineBuildInfo([config], sys.vfs, sys.writtenFiles); - return sys.exit(exitStatus); - } - - function performIncrementalCompilation(sys: TscCompileSystem, config: ParsedCommandLine) { - const reportDiagnostic = createDiagnosticReporter(sys, config.options.pretty); - const { options, fileNames, projectReferences } = config; - const host = createIncrementalCompilerHost(options, sys); - fakes.patchHostForBuildInfoReadWrite(host); - const exitCode = ts.performIncrementalCompilation({ - host, - system: sys, - rootNames: fileNames, - options, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), - projectReferences, - reportDiagnostic, - reportErrorSummary: createReportErrorSummary(sys, options), - }); - baselineBuildInfo([config], sys.vfs, sys.writtenFiles); - return sys.exit(exitCode); - } - - function performBuild(sys: TscCompileSystem, args: string[]) { - const { buildOptions, projects, errors } = parseBuildCommand(args); - const reportDiagnostic = createDiagnosticReporter(sys, buildOptions.pretty); - - if (errors.length > 0) { - errors.forEach(reportDiagnostic); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - Debug.assert(projects.length !== 0); - - const buildHost = createSolutionBuilderHost( - sys, - /*createProgram*/ undefined, - reportDiagnostic, - createBuilderStatusReporter(sys, buildOptions.pretty), - createReportErrorSummary(sys, buildOptions) - ); - fakes.patchSolutionBuilderHost(buildHost, sys); - const builder = createSolutionBuilder(buildHost, projects, buildOptions); - const exitCode = buildOptions.clean ? builder.clean() : builder.build(); - baselineBuildInfo(builder.getAllParsedConfigs(), sys.vfs, sys.writtenFiles); - return sys.exit(exitCode); - } - - function isBuild(commandLineArgs: readonly string[]) { - if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) { - const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase(); - return firstOption === "build" || firstOption === "b"; - } - return false; - } export enum BuildKind { Initial = "initial-build", @@ -221,7 +60,16 @@ namespace ts { sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`); sys.exit = exitCode => sys.exitCode = exitCode; - executeCommandLine(sys, commandLineArgs); + ts.executeCommandLine( + sys, + { + onCompilerHostCreate: host => fakes.patchHostForBuildInfoReadWrite(host), + onCompilationComplete: config => baselineBuildInfo([config], sys.vfs, sys.writtenFiles), + onSolutionBuilderHostCreate: host => fakes.patchSolutionBuilderHost(host, sys), + onSolutionBuildComplete: configs => baselineBuildInfo(configs, sys.vfs, sys.writtenFiles), + }, + commandLineArgs, + ); sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`); if (baselineReadFileCalls) { sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); diff --git a/src/tsc/executeCommandLine.ts b/src/tsc/executeCommandLine.ts new file mode 100644 index 00000000000..1496ac39931 --- /dev/null +++ b/src/tsc/executeCommandLine.ts @@ -0,0 +1,725 @@ +namespace ts { + interface Statistic { + name: string; + value: string; + } + + function countLines(program: Program): number { + let count = 0; + forEach(program.getSourceFiles(), file => { + count += getLineStarts(file).length; + }); + return count; + } + + function updateReportDiagnostic( + sys: System, + existing: DiagnosticReporter, + options: CompilerOptions | BuildOptions + ): DiagnosticReporter { + return shouldBePretty(sys, options) ? + createDiagnosticReporter(sys, /*pretty*/ true) : + existing; + } + + function defaultIsPretty(sys: System) { + return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY(); + } + + function shouldBePretty(sys: System, options: CompilerOptions | BuildOptions) { + if (!options || typeof options.pretty === "undefined") { + return defaultIsPretty(sys); + } + return options.pretty; + } + + function padLeft(s: string, length: number) { + while (s.length < length) { + s = " " + s; + } + return s; + } + + function padRight(s: string, length: number) { + while (s.length < length) { + s = s + " "; + } + + return s; + } + + function getOptionsForHelp(commandLine: ParsedCommandLine) { + // Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch") + return !!commandLine.options.all ? + sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : + filter(optionDeclarations.slice(), v => !!v.showInSimplifiedHelpView); + } + + function printVersion(sys: System) { + sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine); + } + + function printHelp(sys: System, optionsList: readonly CommandLineOption[], syntaxPrefix = "") { + const output: string[] = []; + + // We want to align our "syntax" and "examples" commands to a certain margin. + const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length; + const examplesLength = getDiagnosticText(Diagnostics.Examples_Colon_0, "").length; + let marginLength = Math.max(syntaxLength, examplesLength); + + // Build up the syntactic skeleton. + let syntax = makePadding(marginLength - syntaxLength); + syntax += `tsc ${syntaxPrefix}[${getDiagnosticText(Diagnostics.options)}] [${getDiagnosticText(Diagnostics.file)}...]`; + + output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax)); + output.push(sys.newLine + sys.newLine); + + // Build up the list of examples. + const padding = makePadding(marginLength); + output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine); + output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine); + output.push(padding + "tsc @args.txt" + sys.newLine); + output.push(padding + "tsc --build tsconfig.json" + sys.newLine); + output.push(sys.newLine); + + output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine); + + // We want our descriptions to align at the same column in our output, + // so we keep track of the longest option usage string. + marginLength = 0; + const usageColumn: string[] = []; // Things like "-d, --declaration" go in here. + const descriptionColumn: string[] = []; + + const optionsDescriptionMap = createMap(); // Map between option.description and list of option.type if it is a kind + + for (const option of optionsList) { + // If an option lacks a description, + // it is not officially supported. + if (!option.description) { + continue; + } + + let usageText = " "; + if (option.shortName) { + usageText += "-" + option.shortName; + usageText += getParamType(option); + usageText += ", "; + } + + usageText += "--" + option.name; + usageText += getParamType(option); + + usageColumn.push(usageText); + let description: string; + + if (option.name === "lib") { + description = getDiagnosticText(option.description); + const element = (option).element; + const typeMap = >element.type; + optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`)); + } + else { + description = getDiagnosticText(option.description); + } + + descriptionColumn.push(description); + + // Set the new margin for the description column if necessary. + marginLength = Math.max(usageText.length, marginLength); + } + + // Special case that can't fit in the loop. + const usageText = " @<" + getDiagnosticText(Diagnostics.file) + ">"; + usageColumn.push(usageText); + descriptionColumn.push(getDiagnosticText(Diagnostics.Insert_command_line_options_and_files_from_a_file)); + marginLength = Math.max(usageText.length, marginLength); + + // Print out each row, aligning all the descriptions on the same column. + for (let i = 0; i < usageColumn.length; i++) { + const usage = usageColumn[i]; + const description = descriptionColumn[i]; + const kindsList = optionsDescriptionMap.get(description); + output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine); + + if (kindsList) { + output.push(makePadding(marginLength + 4)); + for (const kind of kindsList) { + output.push(kind + " "); + } + output.push(sys.newLine); + } + } + + for (const line of output) { + sys.write(line); + } + return; + + function getParamType(option: CommandLineOption) { + if (option.paramType !== undefined) { + return " " + getDiagnosticText(option.paramType); + } + return ""; + } + + function makePadding(paddingLength: number): string { + return Array(paddingLength + 1).join(" "); + } + } + + function executeCommandLineWorker( + sys: System, + cb: ExecuteCommandLineCallbacks | undefined, + commandLine: ParsedCommandLine, + ) { + let reportDiagnostic = createDiagnosticReporter(sys); + if (commandLine.options.build) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + // Configuration file name (if any) + let configFileName: string | undefined; + if (commandLine.options.locale) { + validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors); + } + + // If there are any errors due to command line parsing and/or + // setting up localization, report them and quit. + if (commandLine.errors.length > 0) { + commandLine.errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + if (commandLine.options.init) { + writeConfigFile(sys, reportDiagnostic, commandLine.options, commandLine.fileNames); + return sys.exit(ExitStatus.Success); + } + + if (commandLine.options.version) { + printVersion(sys); + return sys.exit(ExitStatus.Success); + } + + if (commandLine.options.help || commandLine.options.all) { + printVersion(sys); + printHelp(sys, getOptionsForHelp(commandLine)); + return sys.exit(ExitStatus.Success); + } + + if (commandLine.options.project) { + if (commandLine.fileNames.length !== 0) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + const fileOrDirectory = normalizePath(commandLine.options.project); + if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) { + configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); + if (!sys.fileExists(configFileName)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } + else { + configFileName = fileOrDirectory; + if (!sys.fileExists(configFileName)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + } + } + else if (commandLine.fileNames.length === 0) { + const searchPath = normalizePath(sys.getCurrentDirectory()); + configFileName = findConfigFile(searchPath, sys.fileExists); + } + + if (commandLine.fileNames.length === 0 && !configFileName) { + printVersion(sys); + printHelp(sys, getOptionsForHelp(commandLine)); + return sys.exit(ExitStatus.Success); + } + + const currentDirectory = sys.getCurrentDirectory(); + const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames); + const commandLineOptions = convertToOptionsWithAbsolutePaths( + commandLine.options, + fileName => toPath(fileName, currentDirectory, getCanonicalFileName) + ); + if (configFileName) { + const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217 + if (commandLineOptions.showConfig) { + if (configParseResult.errors.length !== 0) { + reportDiagnostic = updateReportDiagnostic( + sys, + reportDiagnostic, + configParseResult.options + ); + configParseResult.errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + // eslint-disable-next-line no-null/no-null + sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine); + return sys.exit(ExitStatus.Success); + } + reportDiagnostic = updateReportDiagnostic( + sys, + reportDiagnostic, + configParseResult.options + ); + if (isWatchSet(configParseResult.options)) { + if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; + createWatchOfConfigFile( + sys, + reportDiagnostic, + configParseResult, + commandLineOptions + ); + } + else if (isIncrementalCompilation(configParseResult.options)) { + performIncrementalCompilation( + sys, + reportDiagnostic, + cb, + configParseResult + ); + } + else { + performCompilation( + sys, + reportDiagnostic, + cb, + configParseResult + ); + } + } + else { + if (commandLineOptions.showConfig) { + // eslint-disable-next-line no-null/no-null + sys.write(JSON.stringify(convertToTSConfig(commandLine, combinePaths(currentDirectory, "tsconfig.json"), sys), null, 4) + sys.newLine); + return sys.exit(ExitStatus.Success); + } + reportDiagnostic = updateReportDiagnostic( + sys, + reportDiagnostic, + commandLineOptions + ); + if (isWatchSet(commandLineOptions)) { + if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; + createWatchOfFilesAndCompilerOptions( + sys, + reportDiagnostic, + commandLine.fileNames, + commandLineOptions + ); + } + else if (isIncrementalCompilation(commandLineOptions)) { + performIncrementalCompilation( + sys, + reportDiagnostic, + cb, + { ...commandLine, options: commandLineOptions } + ); + } + else { + performCompilation( + sys, + reportDiagnostic, + cb, + { ...commandLine, options: commandLineOptions } + ); + } + } + } + + export function isBuild(commandLineArgs: readonly string[]) { + if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) { + const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase(); + return firstOption === "build" || firstOption === "b"; + } + return false; + } + + export interface ExecuteCommandLineCallbacks { + onCompilerHostCreate: (host: CompilerHost) => void; + onCompilationComplete: (config: ParsedCommandLine) => void; + onSolutionBuilderHostCreate: (host: SolutionBuilderHost | SolutionBuilderWithWatchHost) => void; + onSolutionBuildComplete: (configs: readonly ParsedCommandLine[]) => void; + } + export function executeCommandLine( + system: System, + cb: ExecuteCommandLineCallbacks, + commandLineArgs: readonly string[], + ): void { + if (isBuild(commandLineArgs)) { + return performBuild( + system, + cb, + commandLineArgs.slice(1) + ); + } + + const commandLine = parseCommandLine(commandLineArgs, path => system.readFile(path)); + if (commandLine.options.generateCpuProfile && system.enableCPUProfiler) { + system.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker( + system, + cb, + commandLine + )); + } + else { + executeCommandLineWorker(system, cb, commandLine); + } + } + + function reportWatchModeWithoutSysSupport(sys: System, reportDiagnostic: DiagnosticReporter) { + if (!sys.watchFile || !sys.watchDirectory) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); + sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + return true; + } + return false; + } + + function performBuildWorker( + sys: System, + cb: ExecuteCommandLineCallbacks | undefined, + buildOptions: BuildOptions, + projects: string[], + errors: Diagnostic[] + ) { + // Update to pretty if host supports it + const reportDiagnostic = updateReportDiagnostic( + sys, + createDiagnosticReporter(sys), + buildOptions + ); + + if (buildOptions.locale) { + validateLocaleAndSetLanguage(buildOptions.locale, sys, errors); + } + + if (errors.length > 0) { + errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + if (buildOptions.help) { + printVersion(sys); + printHelp(sys, buildOpts, "--build "); + return sys.exit(ExitStatus.Success); + } + + if (projects.length === 0) { + printVersion(sys); + printHelp(sys, buildOpts, "--build "); + return sys.exit(ExitStatus.Success); + } + + if (!sys.getModifiedTime || !sys.setModifiedTime || (buildOptions.clean && !sys.deleteFile)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build")); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + + if (buildOptions.watch) { + if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; + const buildHost = createSolutionBuilderWithWatchHost( + sys, + /*createProgram*/ undefined, + reportDiagnostic, + createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), + createWatchStatusReporter(sys, buildOptions) + ); + if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost); + updateCreateProgram(sys, buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram()); + const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions); + builder.build(); + return; + } + + const buildHost = createSolutionBuilderHost( + sys, + /*createProgram*/ undefined, + reportDiagnostic, + createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), + createReportErrorSummary(sys, buildOptions) + ); + if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost); + updateCreateProgram(sys, buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram()); + const builder = createSolutionBuilder(buildHost, projects, buildOptions); + const exitStatus = buildOptions.clean ? builder.clean() : builder.build(); + if (cb && cb.onSolutionBuildComplete) cb.onSolutionBuildComplete(builder.getAllParsedConfigs()); + return sys.exit(exitStatus); + } + + function performBuild( + sys: System, + cb: ExecuteCommandLineCallbacks | undefined, + args: readonly string[] + ) { + const { buildOptions, projects, errors } = parseBuildCommand(args); + if (buildOptions.generateCpuProfile && sys.enableCPUProfiler) { + sys.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuildWorker( + sys, + cb, + buildOptions, + projects, + errors + )); + } + else { + performBuildWorker( + sys, + cb, + buildOptions, + projects, + errors + ); + } + } + + function createReportErrorSummary(sys: System, options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined { + return shouldBePretty(sys, options) ? + errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) : + undefined; + } + + function performCompilation( + sys: System, + reportDiagnostic: DiagnosticReporter, + cb: ExecuteCommandLineCallbacks | undefined, + config: ParsedCommandLine + ) { + const { fileNames, options, projectReferences } = config; + const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys); + if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host); + const currentDirectory = host.getCurrentDirectory(); + const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); + enableStatistics(sys, options); + + const programOptions: CreateProgramOptions = { + rootNames: fileNames, + options, + projectReferences, + host, + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config) + }; + const program = createProgram(programOptions); + const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( + program, + reportDiagnostic, + s => sys.write(s + sys.newLine), + createReportErrorSummary(sys, options) + ); + reportStatistics(sys, program); + if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config); + return sys.exit(exitStatus); + } + + function performIncrementalCompilation( + sys: System, + reportDiagnostic: DiagnosticReporter, + cb: ExecuteCommandLineCallbacks | undefined, + config: ParsedCommandLine + ) { + const { options, fileNames, projectReferences } = config; + enableStatistics(sys, options); + const host = createIncrementalCompilerHost(options, sys); + if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host); + const exitStatus = ts.performIncrementalCompilation({ + host, + system: sys, + rootNames: fileNames, + options, + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), + projectReferences, + reportDiagnostic, + reportErrorSummary: createReportErrorSummary(sys, options), + afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(sys, builderProgram.getProgram()) + }); + if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config); + return sys.exit(exitStatus); + } + + function updateCreateProgram(sys: System, host: { createProgram: CreateProgram; }) { + const compileUsingBuilder = host.createProgram; + host.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => { + Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram)); + if (options !== undefined) { + enableStatistics(sys, options); + } + return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); + }; + } + + function updateWatchCompilationHost(sys: System, watchCompilerHost: WatchCompilerHost) { + updateCreateProgram(sys, watchCompilerHost); + const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217 + watchCompilerHost.afterProgramCreate = builderProgram => { + emitFilesUsingBuilder(builderProgram); + reportStatistics(sys, builderProgram.getProgram()); + }; + } + + function createWatchStatusReporter(sys: System, options: CompilerOptions | BuildOptions) { + return ts.createWatchStatusReporter(sys, shouldBePretty(sys, options)); + } + + function createWatchOfConfigFile( + sys: System, + reportDiagnostic: DiagnosticReporter, + configParseResult: ParsedCommandLine, + optionsToExtend: CompilerOptions + ) { + const watchCompilerHost = createWatchCompilerHostOfConfigFile( + configParseResult.options.configFilePath!, + optionsToExtend, + sys, + /*createProgram*/ undefined, + reportDiagnostic, + createWatchStatusReporter(sys, configParseResult.options) + ); // TODO: GH#18217 + updateWatchCompilationHost(sys, watchCompilerHost); + watchCompilerHost.configFileParsingResult = configParseResult; + createWatchProgram(watchCompilerHost); + } + + function createWatchOfFilesAndCompilerOptions( + sys: System, + reportDiagnostic: DiagnosticReporter, + rootFiles: string[], + options: CompilerOptions + ) { + const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions( + rootFiles, + options, + sys, + /*createProgram*/ undefined, + reportDiagnostic, + createWatchStatusReporter(sys, options) + ); + updateWatchCompilationHost(sys, watchCompilerHost); + createWatchProgram(watchCompilerHost); + } + + function canReportDiagnostics(sys: System, compilerOptions: CompilerOptions) { + return sys === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics); + } + + function enableStatistics(sys: System, compilerOptions: CompilerOptions) { + if (canReportDiagnostics(sys, compilerOptions)) { + performance.enable(); + } + } + + function reportStatistics(sys: System, program: Program) { + let statistics: Statistic[]; + const compilerOptions = program.getCompilerOptions(); + if (canReportDiagnostics(sys, compilerOptions)) { + statistics = []; + const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1; + reportCountStatistic("Files", program.getSourceFiles().length); + reportCountStatistic("Lines", countLines(program)); + reportCountStatistic("Nodes", program.getNodeCount()); + reportCountStatistic("Identifiers", program.getIdentifierCount()); + reportCountStatistic("Symbols", program.getSymbolCount()); + reportCountStatistic("Types", program.getTypeCount()); + + if (memoryUsed >= 0) { + reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); + } + + const programTime = performance.getDuration("Program"); + const bindTime = performance.getDuration("Bind"); + const checkTime = performance.getDuration("Check"); + const emitTime = performance.getDuration("Emit"); + if (compilerOptions.extendedDiagnostics) { + const caches = program.getRelationCacheSizes(); + reportCountStatistic("Assignability cache size", caches.assignable); + reportCountStatistic("Identity cache size", caches.identity); + reportCountStatistic("Subtype cache size", caches.subtype); + performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration)); + } + else { + // Individual component times. + // Note: To match the behavior of previous versions of the compiler, the reported parse time includes + // I/O read time and processing time for triple-slash references and module imports, and the reported + // emit time includes I/O write time. We preserve this behavior so we can accurately compare times. + reportTimeStatistic("I/O read", performance.getDuration("I/O Read")); + reportTimeStatistic("I/O write", performance.getDuration("I/O Write")); + reportTimeStatistic("Parse time", programTime); + reportTimeStatistic("Bind time", bindTime); + reportTimeStatistic("Check time", checkTime); + reportTimeStatistic("Emit time", emitTime); + } + reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); + reportStatistics(); + + performance.disable(); + } + + function reportStatistics() { + let nameSize = 0; + let valueSize = 0; + for (const { name, value } of statistics) { + if (name.length > nameSize) { + nameSize = name.length; + } + + if (value.length > valueSize) { + valueSize = value.length; + } + } + + for (const { name, value } of statistics) { + sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + sys.newLine); + } + } + + function reportStatisticalValue(name: string, value: string) { + statistics.push({ name, value }); + } + + function reportCountStatistic(name: string, count: number) { + reportStatisticalValue(name, "" + count); + } + + function reportTimeStatistic(name: string, time: number) { + reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); + } + } + + function writeConfigFile( + sys: System, + reportDiagnostic: DiagnosticReporter, + options: CompilerOptions, + fileNames: string[] + ) { + const currentDirectory = sys.getCurrentDirectory(); + const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json")); + if (sys.fileExists(file)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)); + } + else { + sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine)); + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file)); + } + + return; + } +} + +if (ts.Debug.isDebugging) { + ts.Debug.enableDebugInfo(); +} + +if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) { + ts.sys.tryEnableSourceMapsForHost(); +} + +if (ts.sys.setBlocking) { + ts.sys.setBlocking(); +} diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 61fff1f1005..17c45fbf0d0 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -1,450 +1,11 @@ -namespace ts { - interface Statistic { - name: string; - value: string; - } - - function countLines(program: Program): number { - let count = 0; - forEach(program.getSourceFiles(), file => { - count += getLineStarts(file).length; - }); - return count; - } - - let reportDiagnostic = createDiagnosticReporter(sys); - function updateReportDiagnostic(options: CompilerOptions | BuildOptions) { - if (shouldBePretty(options)) { - reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true); - } - } - - function defaultIsPretty() { - return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY(); - } - - function shouldBePretty(options: CompilerOptions | BuildOptions) { - if (!options || typeof options.pretty === "undefined") { - return defaultIsPretty(); - } - return options.pretty; - } - - function padLeft(s: string, length: number) { - while (s.length < length) { - s = " " + s; - } - return s; - } - - function padRight(s: string, length: number) { - while (s.length < length) { - s = s + " "; - } - - return s; - } - - function getOptionsForHelp(commandLine: ParsedCommandLine) { - // Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch") - return !!commandLine.options.all ? - sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : - filter(optionDeclarations.slice(), v => !!v.showInSimplifiedHelpView); - } - - function executeCommandLineWorker(commandLine: ParsedCommandLine) { - if (commandLine.options.build) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - // Configuration file name (if any) - let configFileName: string | undefined; - if (commandLine.options.locale) { - validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors); - } - - // If there are any errors due to command line parsing and/or - // setting up localization, report them and quit. - if (commandLine.errors.length > 0) { - commandLine.errors.forEach(reportDiagnostic); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - if (commandLine.options.init) { - writeConfigFile(commandLine.options, commandLine.fileNames); - return sys.exit(ExitStatus.Success); - } - - if (commandLine.options.version) { - printVersion(); - return sys.exit(ExitStatus.Success); - } - - if (commandLine.options.help || commandLine.options.all) { - printVersion(); - printHelp(getOptionsForHelp(commandLine)); - return sys.exit(ExitStatus.Success); - } - - if (commandLine.options.project) { - if (commandLine.fileNames.length !== 0) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - const fileOrDirectory = normalizePath(commandLine.options.project); - if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) { - configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); - if (!sys.fileExists(configFileName)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - } - else { - configFileName = fileOrDirectory; - if (!sys.fileExists(configFileName)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project)); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - } - } - else if (commandLine.fileNames.length === 0) { - const searchPath = normalizePath(sys.getCurrentDirectory()); - configFileName = findConfigFile(searchPath, sys.fileExists); - } - - if (commandLine.fileNames.length === 0 && !configFileName) { - printVersion(); - printHelp(getOptionsForHelp(commandLine)); - return sys.exit(ExitStatus.Success); - } - - const currentDirectory = sys.getCurrentDirectory(); - const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames); - const commandLineOptions = convertToOptionsWithAbsolutePaths( - commandLine.options, - fileName => toPath(fileName, currentDirectory, getCanonicalFileName) - ); - if (configFileName) { - const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217 - if (commandLineOptions.showConfig) { - if (configParseResult.errors.length !== 0) { - updateReportDiagnostic(configParseResult.options); - configParseResult.errors.forEach(reportDiagnostic); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - // eslint-disable-next-line no-null/no-null - sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine); - return sys.exit(ExitStatus.Success); - } - updateReportDiagnostic(configParseResult.options); - if (isWatchSet(configParseResult.options)) { - reportWatchModeWithoutSysSupport(); - createWatchOfConfigFile(configParseResult, commandLineOptions); - } - else if (isIncrementalCompilation(configParseResult.options)) { - performIncrementalCompilation(configParseResult); - } - else { - performCompilation(configParseResult.fileNames, configParseResult.projectReferences, configParseResult.options, getConfigFileParsingDiagnostics(configParseResult)); - } - } - else { - if (commandLineOptions.showConfig) { - // eslint-disable-next-line no-null/no-null - sys.write(JSON.stringify(convertToTSConfig(commandLine, combinePaths(currentDirectory, "tsconfig.json"), sys), null, 4) + sys.newLine); - return sys.exit(ExitStatus.Success); - } - updateReportDiagnostic(commandLineOptions); - if (isWatchSet(commandLineOptions)) { - reportWatchModeWithoutSysSupport(); - createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions); - } - else if (isIncrementalCompilation(commandLineOptions)) { - performIncrementalCompilation({ - ...commandLine, - options: commandLineOptions - }); - } - else { - performCompilation(commandLine.fileNames, /*references*/ undefined, commandLineOptions); - } - } - } - - export function executeCommandLine(args: string[]): void { - if (args.length > 0 && args[0].charCodeAt(0) === CharacterCodes.minus) { - const firstOption = args[0].slice(args[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase(); - if (firstOption === "build" || firstOption === "b") { - return performBuild(args.slice(1)); - } - } - - const commandLine = parseCommandLine(args); - - if (commandLine.options.generateCpuProfile && sys.enableCPUProfiler) { - sys.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker(commandLine)); - } - else { - executeCommandLineWorker(commandLine); - } - } - - function reportWatchModeWithoutSysSupport() { - if (!sys.watchFile || !sys.watchDirectory) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - } - - function performBuildWorker(buildOptions: BuildOptions, projects: string[], errors: Diagnostic[]) { - // Update to pretty if host supports it - updateReportDiagnostic(buildOptions); - - if (buildOptions.locale) { - validateLocaleAndSetLanguage(buildOptions.locale, sys, errors); - } - - if (errors.length > 0) { - errors.forEach(reportDiagnostic); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - if (buildOptions.help) { - printVersion(); - printHelp(buildOpts, "--build "); - return sys.exit(ExitStatus.Success); - } - - if (projects.length === 0) { - printVersion(); - printHelp(buildOpts, "--build "); - return sys.exit(ExitStatus.Success); - } - - if (!sys.getModifiedTime || !sys.setModifiedTime || (buildOptions.clean && !sys.deleteFile)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build")); - return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); - } - - if (buildOptions.watch) { - reportWatchModeWithoutSysSupport(); - const buildHost = createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)); - updateCreateProgram(buildHost); - buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); - const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions); - builder.build(); - return; - } - - const buildHost = createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions)); - updateCreateProgram(buildHost); - buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); - const builder = createSolutionBuilder(buildHost, projects, buildOptions); - return sys.exit(buildOptions.clean ? builder.clean() : builder.build()); - } - - function performBuild(args: string[]) { - const { buildOptions, projects, errors } = parseBuildCommand(args); - if (buildOptions.generateCpuProfile && sys.enableCPUProfiler) { - sys.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuildWorker(buildOptions, projects, errors)); - } - else { - performBuildWorker(buildOptions, projects, errors); - } - } - - function createReportErrorSummary(options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined { - return shouldBePretty(options) ? - errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) : - undefined; - } - - function performCompilation(rootNames: string[], projectReferences: readonly ProjectReference[] | undefined, options: CompilerOptions, configFileParsingDiagnostics?: readonly Diagnostic[]) { - const host = createCompilerHost(options); - const currentDirectory = host.getCurrentDirectory(); - const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); - changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); - enableStatistics(options); - - const programOptions: CreateProgramOptions = { - rootNames, - options, - projectReferences, - host, - configFileParsingDiagnostics - }; - const program = createProgram(programOptions); - const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( - program, - reportDiagnostic, - s => sys.write(s + sys.newLine), - createReportErrorSummary(options) - ); - reportStatistics(program); - return sys.exit(exitStatus); - } - - function performIncrementalCompilation(config: ParsedCommandLine) { - const { options, fileNames, projectReferences } = config; - enableStatistics(options); - return sys.exit(ts.performIncrementalCompilation({ - rootNames: fileNames, - options, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), - projectReferences, - reportDiagnostic, - reportErrorSummary: createReportErrorSummary(options), - afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(builderProgram.getProgram()) - })); - } - - function updateCreateProgram(host: { createProgram: CreateProgram; }) { - const compileUsingBuilder = host.createProgram; - host.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => { - Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram)); - if (options !== undefined) { - enableStatistics(options); - } - return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); - }; - } - - function updateWatchCompilationHost(watchCompilerHost: WatchCompilerHost) { - updateCreateProgram(watchCompilerHost); - const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217 - watchCompilerHost.afterProgramCreate = builderProgram => { - emitFilesUsingBuilder(builderProgram); - reportStatistics(builderProgram.getProgram()); - }; - } - - function createWatchStatusReporter(options: CompilerOptions | BuildOptions) { - return ts.createWatchStatusReporter(sys, shouldBePretty(options)); - } - - function createWatchOfConfigFile(configParseResult: ParsedCommandLine, optionsToExtend: CompilerOptions) { - const watchCompilerHost = createWatchCompilerHostOfConfigFile(configParseResult.options.configFilePath!, optionsToExtend, sys, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(configParseResult.options)); // TODO: GH#18217 - updateWatchCompilationHost(watchCompilerHost); - watchCompilerHost.configFileParsingResult = configParseResult; - createWatchProgram(watchCompilerHost); - } - - function createWatchOfFilesAndCompilerOptions(rootFiles: string[], options: CompilerOptions) { - const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions(rootFiles, options, sys, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(options)); - updateWatchCompilationHost(watchCompilerHost); - createWatchProgram(watchCompilerHost); - } - - function enableStatistics(compilerOptions: CompilerOptions) { - if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) { - performance.enable(); - } - } - - function reportStatistics(program: Program) { - let statistics: Statistic[]; - const compilerOptions = program.getCompilerOptions(); - if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) { - statistics = []; - const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1; - reportCountStatistic("Files", program.getSourceFiles().length); - reportCountStatistic("Lines", countLines(program)); - reportCountStatistic("Nodes", program.getNodeCount()); - reportCountStatistic("Identifiers", program.getIdentifierCount()); - reportCountStatistic("Symbols", program.getSymbolCount()); - reportCountStatistic("Types", program.getTypeCount()); - - if (memoryUsed >= 0) { - reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); - } - - const programTime = performance.getDuration("Program"); - const bindTime = performance.getDuration("Bind"); - const checkTime = performance.getDuration("Check"); - const emitTime = performance.getDuration("Emit"); - if (compilerOptions.extendedDiagnostics) { - const caches = program.getRelationCacheSizes(); - reportCountStatistic("Assignability cache size", caches.assignable); - reportCountStatistic("Identity cache size", caches.identity); - reportCountStatistic("Subtype cache size", caches.subtype); - performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration)); - } - else { - // Individual component times. - // Note: To match the behavior of previous versions of the compiler, the reported parse time includes - // I/O read time and processing time for triple-slash references and module imports, and the reported - // emit time includes I/O write time. We preserve this behavior so we can accurately compare times. - reportTimeStatistic("I/O read", performance.getDuration("I/O Read")); - reportTimeStatistic("I/O write", performance.getDuration("I/O Write")); - reportTimeStatistic("Parse time", programTime); - reportTimeStatistic("Bind time", bindTime); - reportTimeStatistic("Check time", checkTime); - reportTimeStatistic("Emit time", emitTime); - } - reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); - reportStatistics(); - - performance.disable(); - } - - function reportStatistics() { - let nameSize = 0; - let valueSize = 0; - for (const { name, value } of statistics) { - if (name.length > nameSize) { - nameSize = name.length; - } - - if (value.length > valueSize) { - valueSize = value.length; - } - } - - for (const { name, value } of statistics) { - sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + sys.newLine); - } - } - - function reportStatisticalValue(name: string, value: string) { - statistics.push({ name, value }); - } - - function reportCountStatistic(name: string, count: number) { - reportStatisticalValue(name, "" + count); - } - - function reportTimeStatistic(name: string, time: number) { - reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); - } - } - - function writeConfigFile(options: CompilerOptions, fileNames: string[]) { - const currentDirectory = sys.getCurrentDirectory(); - const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json")); - if (sys.fileExists(file)) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)); - } - else { - sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine)); - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file)); - } - - return; - } -} - -if (ts.Debug.isDebugging) { - ts.Debug.enableDebugInfo(); -} - -if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) { - ts.sys.tryEnableSourceMapsForHost(); -} - -if (ts.sys.setBlocking) { - ts.sys.setBlocking(); -} - -ts.executeCommandLine(ts.sys.args); +// This file actually uses arguments passed on commandline and executes it +ts.executeCommandLine( + ts.sys, + { + onCompilerHostCreate: ts.noop, + onCompilationComplete: ts.noop, + onSolutionBuilderHostCreate: ts.noop, + onSolutionBuildComplete: ts.noop + }, + ts.sys.args +); diff --git a/src/tsc/tsconfig.json b/src/tsc/tsconfig.json index e97cedc5de2..7de3cb82a95 100644 --- a/src/tsc/tsconfig.json +++ b/src/tsc/tsconfig.json @@ -4,6 +4,7 @@ "outFile": "../../built/local/tsc.js" }, "files": [ + "executeCommandLine.ts", "tsc.ts" ], "references": [ From 4b13406bafe15c5be56c3bc81770f118308f8434 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 11:52:46 -0700 Subject: [PATCH 09/16] transitiveReferences as baseline --- .../unittests/tsbuild/transitiveReferences.ts | 70 +++------- ...roject-uses-different-module-resolution.js | 129 ++++++++++++++++++ .../initial-build/builds-correctly.js | 127 +++++++++++++++++ ...de-resolution-with-external-module-name.js | 61 +++++++++ 4 files changed, 334 insertions(+), 53 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly-when-the-referenced-project-uses-different-module-resolution.js create mode 100644 tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly.js create mode 100644 tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 99fcd75d087..735c13f5976 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -1,23 +1,6 @@ namespace ts { describe("unittests:: tsbuild:: when project reference is referenced transitively", () => { let projFs: vfs.FileSystem; - const allExpectedOutputs = [ - "/src/a.js", "/src/a.d.ts", - "/src/b.js", "/src/b.d.ts", - "/src/c.js" - ]; - const expectedFileTraces = [ - "/lib/lib.d.ts", - "/src/a.ts", - "/lib/lib.d.ts", - "/src/a.d.ts", - "/src/b.ts", - "/lib/lib.d.ts", - "/src/a.d.ts", - "/src/b.d.ts", - "/src/refs/a.d.ts", - "/src/c.ts" - ]; before(() => { projFs = loadProjectFromDisk("tests/projects/transitiveReferences"); }); @@ -25,17 +8,6 @@ namespace ts { projFs = undefined!; // Release the contents }); - function verifyBuild(modifyDiskLayout: (fs: vfs.FileSystem) => void, allExpectedOutputs: readonly string[], expectedFileTraces: readonly string[], ...expectedDiagnostics: fakes.ExpectedDiagnostic[]) { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - modifyDiskLayout(fs); - const builder = createSolutionBuilder(host, ["/src/tsconfig.c.json"], { listFiles: true }); - builder.build(); - host.assertDiagnosticMessages(...expectedDiagnostics); - verifyOutputsPresent(fs, allExpectedOutputs); - assert.deepEqual(host.traces, expectedFileTraces); - } - function modifyFsBTsToNonRelativeImport(fs: vfs.FileSystem, moduleResolution: "node" | "classic") { fs.writeFileSync("/src/b.ts", `import {A} from 'a'; export const b = new A();`); @@ -49,35 +21,27 @@ export const b = new A();`); })); } - it("verify that it builds correctly", () => { - verifyBuild(noop, allExpectedOutputs, expectedFileTraces); + verifyTsc({ + scenario: "transitiveReferences", + subScenario: "builds correctly", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"], }); - it("verify that it builds correctly when the referenced project uses different module resolution", () => { - verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "classic"), allExpectedOutputs, expectedFileTraces); + verifyTsc({ + scenario: "transitiveReferences", + subScenario: "builds correctly when the referenced project uses different module resolution", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"], + modifyFs: fs => modifyFsBTsToNonRelativeImport(fs, "classic"), }); - it("verify that it build reports error about module not found with node resolution with external module name", () => { - // Error in b build only a - const allExpectedOutputs = ["/src/a.js", "/src/a.d.ts"]; - const expectedFileTraces = [ - "/lib/lib.d.ts", - "/src/a.ts", - "/lib/lib.d.ts", - "/src/b.ts" - ]; - verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"), - allExpectedOutputs, - expectedFileTraces, - { - message: [Diagnostics.Cannot_find_module_0, "a"], - location: { - file: "/src/b.ts", - start: `import {A} from 'a';`.indexOf(`'a'`), - length: `'a'`.length - } - }, - ); + verifyTsc({ + scenario: "transitiveReferences", + subScenario: "reports error about module not found with node resolution with external module name", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"], + modifyFs: fs => modifyFsBTsToNonRelativeImport(fs, "node"), }); }); } diff --git a/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly-when-the-referenced-project-uses-different-module-resolution.js b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly-when-the-referenced-project-uses-different-module-resolution.js new file mode 100644 index 00000000000..aaa2ca6695e --- /dev/null +++ b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly-when-the-referenced-project-uses-different-module-resolution.js @@ -0,0 +1,129 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.c.json --listFiles +/lib/lib.d.ts +/src/a.ts +/lib/lib.d.ts +/src/a.d.ts +/src/b.ts +/lib/lib.d.ts +/src/a.d.ts +/src/b.d.ts +/src/refs/a.d.ts +/src/c.ts +exitCode:: ExitStatus.Success + + +//// [/src/a.d.ts] +export declare class A { +} + + +//// [/src/a.js] +"use strict"; +exports.__esModule = true; +var A = /** @class */ (function () { + function A() { + } + return A; +}()); +exports.A = A; + + +//// [/src/b.d.ts] +import { A } from 'a'; +export declare const b: A; + + +//// [/src/b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("a"); +exports.b = new a_1.A(); + + +//// [/src/b.ts] +import {A} from 'a'; +export const b = new A(); + +//// [/src/c.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var a_1 = require("@ref/a"); +b_1.b; +a_1.X; + + +//// [/src/tsconfig.a.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; };" + }, + "./a.ts": { + "version": "-8566332115-export class A {}\r\n", + "signature": "-9529994156-export declare class A {\r\n}\r\n" + } + }, + "options": { + "composite": true, + "listFiles": true, + "configFilePath": "./tsconfig.a.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.b.json] +{"compilerOptions":{"composite":true,"moduleResolution":"classic"},"files":["b.ts"],"references":[{"path":"tsconfig.a.json"}]} + +//// [/src/tsconfig.b.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; };" + }, + "./a.ts": { + "version": "-9529994156-export declare class A {\r\n}\r\n", + "signature": "-9529994156-export declare class A {\r\n}\r\n" + }, + "./b.ts": { + "version": "-17186364832-import {A} from 'a';\nexport const b = new A();", + "signature": "-9520743082-import { A } from 'a';\r\nexport declare const b: A;\r\n" + } + }, + "options": { + "composite": true, + "moduleResolution": 1, + "listFiles": true, + "configFilePath": "./tsconfig.b.json" + }, + "referencedMap": { + "./b.ts": [ + "./a.d.ts" + ] + }, + "exportedModulesMap": { + "./b.ts": [ + "./a.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts", + "./b.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly.js b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly.js new file mode 100644 index 00000000000..14ed47ea4c8 --- /dev/null +++ b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/builds-correctly.js @@ -0,0 +1,127 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.c.json --listFiles +/lib/lib.d.ts +/src/a.ts +/lib/lib.d.ts +/src/a.d.ts +/src/b.ts +/lib/lib.d.ts +/src/a.d.ts +/src/b.d.ts +/src/refs/a.d.ts +/src/c.ts +exitCode:: ExitStatus.Success + + +//// [/src/a.d.ts] +export declare class A { +} + + +//// [/src/a.js] +"use strict"; +exports.__esModule = true; +var A = /** @class */ (function () { + function A() { + } + return A; +}()); +exports.A = A; + + +//// [/src/b.d.ts] +import { A } from '@ref/a'; +export declare const b: A; + + +//// [/src/b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("@ref/a"); +exports.b = new a_1.A(); + + +//// [/src/c.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var a_1 = require("@ref/a"); +b_1.b; +a_1.X; + + +//// [/src/tsconfig.a.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; };" + }, + "./a.ts": { + "version": "-8566332115-export class A {}\r\n", + "signature": "-9529994156-export declare class A {\r\n}\r\n" + } + }, + "options": { + "composite": true, + "listFiles": true, + "configFilePath": "./tsconfig.a.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.b.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; };" + }, + "./a.ts": { + "version": "-9529994156-export declare class A {\r\n}\r\n", + "signature": "-9529994156-export declare class A {\r\n}\r\n" + }, + "./b.ts": { + "version": "-13104686224-import {A} from '@ref/a';\r\nexport const b = new A();\r\n", + "signature": "-10067914302-import { A } from '@ref/a';\r\nexport declare const b: A;\r\n" + } + }, + "options": { + "composite": true, + "baseUrl": "./", + "paths": { + "@ref/*": [ + "./*" + ] + }, + "listFiles": true, + "configFilePath": "./tsconfig.b.json" + }, + "referencedMap": { + "./b.ts": [ + "./a.d.ts" + ] + }, + "exportedModulesMap": { + "./b.ts": [ + "./a.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts", + "./b.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js new file mode 100644 index 00000000000..132a07d1faf --- /dev/null +++ b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js @@ -0,0 +1,61 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig.c.json --listFiles +/lib/lib.d.ts +/src/a.ts +src/b.ts(1,17): error TS2307: Cannot find module 'a'. +/lib/lib.d.ts +/src/b.ts +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/a.d.ts] +export declare class A { +} + + +//// [/src/a.js] +"use strict"; +exports.__esModule = true; +var A = /** @class */ (function () { + function A() { + } + return A; +}()); +exports.A = A; + + +//// [/src/b.ts] +import {A} from 'a'; +export const b = new A(); + +//// [/src/tsconfig.a.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; };" + }, + "./a.ts": { + "version": "-8566332115-export class A {}\r\n", + "signature": "-9529994156-export declare class A {\r\n}\r\n" + } + }, + "options": { + "composite": true, + "listFiles": true, + "configFilePath": "./tsconfig.a.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./a.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.b.json] +{"compilerOptions":{"composite":true,"moduleResolution":"node"},"files":["b.ts"],"references":[{"path":"tsconfig.a.json"}]} + From 928a4e799cc4eb633b3abf43eff488e1002b45a3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 12:03:12 -0700 Subject: [PATCH 10/16] resolveJsonModule as baseline test --- .../unittests/tsbuild/resolveJsonModule.ts | 165 ++++++------------ .../files-containing-json-file.js | 73 ++++++++ ...ting-json-module-from-project-reference.js | 108 ++++++++++++ .../initial-build/include-and-files.js | 73 ++++++++ ...r-include-and-file-name-matches-ts-file.js | 15 ++ ...nclude-of-json-along-with-other-include.js | 73 ++++++++ .../initial-build/include-only.js | 6 + .../initial-build/sourcemap.js | 101 +++++++++++ .../initial-build/without-outDir.js | 90 ++++++++++ ...ting-json-module-from-project-reference.js | 14 ++ .../no-change-run/sourcemap.js | 10 ++ .../no-change-run/without-outDir.js | 10 ++ 12 files changed, 623 insertions(+), 115 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/importing-json-module-from-project-reference.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/sourcemap.js create mode 100644 tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/without-outDir.js diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 4d36bab67ba..3d1d8c3549d 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -1,7 +1,6 @@ namespace ts { describe("unittests:: tsbuild:: with resolveJsonModule option on project resolveJsonModuleAndComposite", () => { let projFs: vfs.FileSystem; - const allExpectedOutputs = ["/src/dist/src/index.js", "/src/dist/src/index.d.ts", "/src/dist/src/hello.json"]; before(() => { projFs = loadProjectFromDisk("tests/projects/resolveJsonModuleAndComposite"); }); @@ -10,108 +9,64 @@ namespace ts { projFs = undefined!; // Release the contents }); - function verifyProjectWithResolveJsonModule(configFile: string, ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) { - const fs = projFs.shadow(); - verifyProjectWithResolveJsonModuleWithFs(fs, configFile, allExpectedOutputs, ...expectedDiagnosticMessages); - } - - function verifyProjectWithResolveJsonModuleWithFs(fs: vfs.FileSystem, configFile: string, allExpectedOutputs: readonly string[], ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) { - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, [configFile], { dry: false, force: false, verbose: false }); - builder.build(); - host.assertDiagnosticMessages(...expectedDiagnosticMessages); - if (!expectedDiagnosticMessages.length) { - // Check for outputs. Not an exhaustive list - verifyOutputsPresent(fs, allExpectedOutputs); - } - } - - it("with resolveJsonModule and include only", () => { - verifyProjectWithResolveJsonModule( - "/src/tsconfig_withInclude.json", - { - message: [ - Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, - "/src/src/hello.json", - "/src/tsconfig_withInclude.json" - ], - location: expectedLocationIndexOf(projFs, "/src/src/index.ts", `"./hello.json"`) - } - ); + verifyTsc({ + scenario: "resolveJsonModule", + subScenario: "include only", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig_withInclude.json"], }); - it("with resolveJsonModule and include of *.json along with other include", () => { - verifyProjectWithResolveJsonModule("/src/tsconfig_withIncludeOfJson.json"); + verifyTsc({ + scenario: "resolveJsonModule", + subScenario: "include of json along with other include", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json"], }); - it("with resolveJsonModule and include of *.json along with other include and file name matches ts file", () => { - const fs = projFs.shadow(); - fs.rimrafSync("/src/src/hello.json"); - fs.writeFileSync("/src/src/index.json", JSON.stringify({ hello: "world" })); - fs.writeFileSync("/src/src/index.ts", `import hello from "./index.json" + verifyTsc({ + scenario: "resolveJsonModule", + subScenario: "include of json along with other include and file name matches ts file", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json"], + modifyFs: fs => { + fs.rimrafSync("/src/src/hello.json"); + fs.writeFileSync("/src/src/index.json", JSON.stringify({ hello: "world" })); + fs.writeFileSync("/src/src/index.ts", `import hello from "./index.json" export default hello.hello`); - const allExpectedOutputs = ["/src/dist/src/index.js", "/src/dist/src/index.d.ts", "/src/dist/src/index.json"]; - verifyProjectWithResolveJsonModuleWithFs( - fs, - "/src/tsconfig_withIncludeOfJson.json", - allExpectedOutputs, - errorDiagnostic([Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, "/src/dist/src/index.d.ts"]) - ); + }, }); - it("with resolveJsonModule and files containing json file", () => { - verifyProjectWithResolveJsonModule("/src/tsconfig_withFiles.json"); + verifyTsc({ + scenario: "resolveJsonModule", + subScenario: "files containing json file", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig_withFiles.json"], }); - it("with resolveJsonModule and include and files", () => { - verifyProjectWithResolveJsonModule("/src/tsconfig_withIncludeAndFiles.json"); + verifyTsc({ + scenario: "resolveJsonModule", + subScenario: "include and files", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tsconfig_withIncludeAndFiles.json"], }); - it("with resolveJsonModule and sourceMap", () => { - const { fs, tick } = getFsWithTime(projFs); - const configFile = "src/tsconfig_withFiles.json"; - replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`); - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(configFile), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/dist/src/index.js"], - [Diagnostics.Building_project_0, `/${configFile}`] - ); - verifyOutputsPresent(fs, [...allExpectedOutputs, "/src/dist/src/index.js.map"]); - host.clearDiagnostics(); - builder = createSolutionBuilder(host, [configFile], { verbose: true }); - tick(); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(configFile), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/dist/src/index.js"] - ); + verifyTscIncrementalEdits({ + scenario: "resolveJsonModule", + subScenario: "sourcemap", + fs: () => projFs, + commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"], + modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"composite": true,`, `"composite": true, "sourceMap": true,`), + incrementalScenarios: [noChangeRun] }); - it("with resolveJsonModule and without outDir", () => { - const { fs, tick } = getFsWithTime(projFs); - const configFile = "src/tsconfig_withFiles.json"; - replaceText(fs, configFile, `"outDir": "dist",`, ""); - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(configFile), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/src/index.js"], - [Diagnostics.Building_project_0, `/${configFile}`] - ); - verifyOutputsPresent(fs, ["/src/src/index.js", "/src/src/index.d.ts"]); - host.clearDiagnostics(); - builder = createSolutionBuilder(host, [configFile], { verbose: true }); - tick(); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(configFile), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/src/index.js"] - ); + verifyTscIncrementalEdits({ + scenario: "resolveJsonModule", + subScenario: "without outDir", + fs: () => projFs, + commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"], + modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"outDir": "dist",`, ""), + incrementalScenarios: [noChangeRun] }); }); @@ -125,32 +80,12 @@ export default hello.hello`); projFs = undefined!; // Release the contents }); - it("when importing json module from project reference", () => { - const expectedOutput = "/src/main/index.js"; - const { fs, tick } = getFsWithTime(projFs); - const configFile = "src/tsconfig.json"; - const stringsConfigFile = "src/strings/tsconfig.json"; - const mainConfigFile = "src/main/tsconfig.json"; - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, stringsConfigFile, "src/strings/tsconfig.tsbuildinfo"], - [Diagnostics.Building_project_0, `/${stringsConfigFile}`], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, mainConfigFile, "src/main/index.js"], - [Diagnostics.Building_project_0, `/${mainConfigFile}`], - ); - verifyOutputsPresent(fs, [expectedOutput]); - host.clearDiagnostics(); - builder = createSolutionBuilder(host, [configFile], { verbose: true }); - tick(); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, stringsConfigFile, "src/strings/foo.json", "src/strings/tsconfig.tsbuildinfo"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, mainConfigFile, "src/main/index.ts", "src/main/index.js"], - ); + verifyTscIncrementalEdits({ + scenario: "resolveJsonModule", + subScenario: "importing json module from project reference", + fs: () => projFs, + commandLineArgs: ["--b", "src/tsconfig.json", "--verbose"], + incrementalScenarios: [noChangeRun] }); }); } diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js new file mode 100644 index 00000000000..1d953745219 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js @@ -0,0 +1,73 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig_withFiles.json +exitCode:: ExitStatus.Success + + +//// [/src/dist/src/hello.d.ts] +export declare const hello: string; + + +//// [/src/dist/src/hello.json] +{ + "hello": "world" +} + + +//// [/src/dist/src/index.d.ts] +declare const _default: string; +export default _default; + + +//// [/src/dist/src/index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +var hello_json_1 = __importDefault(require("./hello.json")); +exports["default"] = hello_json_1["default"].hello; + + +//// [/src/dist/tsconfig_withFiles.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; };" + }, + "../src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n" + }, + "../src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n" + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../tsconfig_withFiles.json" + }, + "referencedMap": { + "../src/index.ts": [ + "../src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/hello.json", + "../src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js new file mode 100644 index 00000000000..12542f55749 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js @@ -0,0 +1,108 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b src/tsconfig.json --verbose +12:01:00 AM - Projects in this build: + * src/strings/tsconfig.json + * src/main/tsconfig.json + * src/tsconfig.json + +12:01:00 AM - Project 'src/strings/tsconfig.json' is out of date because output file 'src/strings/tsconfig.tsbuildinfo' does not exist + +12:01:00 AM - Building project '/src/strings/tsconfig.json'... + +12:01:00 AM - Project 'src/main/tsconfig.json' is out of date because output file 'src/main/index.js' does not exist + +12:01:00 AM - Building project '/src/main/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/main/index.d.ts] +export {}; + + +//// [/src/main/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var foo_json_1 = require("../strings/foo.json"); +console.log(foo_json_1.foo); + + +//// [/src/main/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; };" + }, + "../strings/foo.json": { + "version": "-1457151099-export declare const foo: string;\r\n", + "signature": "-1457151099-export declare const foo: string;\r\n" + }, + "./index.ts": { + "version": "-4651661680-import { foo } from '../strings/foo.json';\n\nconsole.log(foo);", + "signature": "-4882119183-export {};\r\n" + } + }, + "options": { + "target": 1, + "module": 1, + "rootDir": "..", + "composite": true, + "resolveJsonModule": true, + "strict": true, + "esModuleInterop": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../strings/foo.d.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../strings/foo.json", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/strings/foo.d.ts] +export declare const foo: string; + + +//// [/src/strings/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; };" + }, + "./foo.json": { + "version": "4395333385-{\n \"foo\": \"bar baz\"\n}", + "signature": "-1457151099-export declare const foo: string;\r\n" + } + }, + "options": { + "target": 1, + "module": 1, + "rootDir": "..", + "composite": true, + "resolveJsonModule": true, + "strict": true, + "esModuleInterop": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./foo.json" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js new file mode 100644 index 00000000000..b4404190e27 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js @@ -0,0 +1,73 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig_withIncludeAndFiles.json +exitCode:: ExitStatus.Success + + +//// [/src/dist/src/hello.d.ts] +export declare const hello: string; + + +//// [/src/dist/src/hello.json] +{ + "hello": "world" +} + + +//// [/src/dist/src/index.d.ts] +declare const _default: string; +export default _default; + + +//// [/src/dist/src/index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +var hello_json_1 = __importDefault(require("./hello.json")); +exports["default"] = hello_json_1["default"].hello; + + +//// [/src/dist/tsconfig_withIncludeAndFiles.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; };" + }, + "../src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n" + }, + "../src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n" + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../tsconfig_withIncludeAndFiles.json" + }, + "referencedMap": { + "../src/index.ts": [ + "../src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/hello.json", + "../src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js new file mode 100644 index 00000000000..0b516b4944f --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js @@ -0,0 +1,15 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig_withIncludeOfJson.json +error TS5056: Cannot write file '/src/dist/src/index.d.ts' because it would be overwritten by multiple input files. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + +//// [/src/src/hello.json] unlink +//// [/src/src/index.json] +{"hello":"world"} + +//// [/src/src/index.ts] +import hello from "./index.json" + +export default hello.hello + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js new file mode 100644 index 00000000000..5bedb91c4be --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js @@ -0,0 +1,73 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig_withIncludeOfJson.json +exitCode:: ExitStatus.Success + + +//// [/src/dist/src/hello.d.ts] +export declare const hello: string; + + +//// [/src/dist/src/hello.json] +{ + "hello": "world" +} + + +//// [/src/dist/src/index.d.ts] +declare const _default: string; +export default _default; + + +//// [/src/dist/src/index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +var hello_json_1 = __importDefault(require("./hello.json")); +exports["default"] = hello_json_1["default"].hello; + + +//// [/src/dist/tsconfig_withIncludeOfJson.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; };" + }, + "../src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n" + }, + "../src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n" + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../tsconfig_withIncludeOfJson.json" + }, + "referencedMap": { + "../src/index.ts": [ + "../src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/hello.json", + "../src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js new file mode 100644 index 00000000000..a809be90609 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js @@ -0,0 +1,6 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tsconfig_withInclude.json +src/src/index.ts(1,19): error TS6307: File '/src/src/hello.json' is not listed within the file list of project '/src/tsconfig_withInclude.json'. Projects must list all files or use an 'include' pattern. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js new file mode 100644 index 00000000000..92ff87ebcad --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js @@ -0,0 +1,101 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b src/tsconfig_withFiles.json --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig_withFiles.json + +12:01:00 AM - Project 'src/tsconfig_withFiles.json' is out of date because output file 'src/dist/src/index.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig_withFiles.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/dist/src/hello.d.ts] +export declare const hello: string; + + +//// [/src/dist/src/hello.json] +{ + "hello": "world" +} + + +//// [/src/dist/src/index.d.ts] +declare const _default: string; +export default _default; + + +//// [/src/dist/src/index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +var hello_json_1 = __importDefault(require("./hello.json")); +exports["default"] = hello_json_1["default"].hello; +//# sourceMappingURL=index.js.map + +//// [/src/dist/src/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,4DAAgC;AAEhC,qBAAe,uBAAK,CAAC,KAAK,CAAA"} + +//// [/src/dist/tsconfig_withFiles.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; };" + }, + "../src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n" + }, + "../src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n" + } + }, + "options": { + "composite": true, + "sourceMap": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../tsconfig_withFiles.json" + }, + "referencedMap": { + "../src/index.ts": [ + "../src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/hello.json", + "../src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig_withFiles.json] +{ + "compilerOptions": { + "composite": true, "sourceMap": true, + "moduleResolution": "node", + "module": "commonjs", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "dist", + "skipDefaultLibCheck": true + }, + "files": [ + "src/index.ts", "src/hello.json" + ] +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js new file mode 100644 index 00000000000..b8756d8bf4b --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js @@ -0,0 +1,90 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b src/tsconfig_withFiles.json --verbose +12:01:00 AM - Projects in this build: + * src/tsconfig_withFiles.json + +12:01:00 AM - Project 'src/tsconfig_withFiles.json' is out of date because output file 'src/src/index.js' does not exist + +12:01:00 AM - Building project '/src/tsconfig_withFiles.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/src/hello.d.ts] +export declare const hello: string; + + +//// [/src/src/index.d.ts] +declare const _default: string; +export default _default; + + +//// [/src/src/index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +exports.__esModule = true; +var hello_json_1 = __importDefault(require("./hello.json")); +exports["default"] = hello_json_1["default"].hello; + + +//// [/src/tsconfig_withFiles.json] +{ + "compilerOptions": { + "composite": true, + "moduleResolution": "node", + "module": "commonjs", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + + "skipDefaultLibCheck": true + }, + "files": [ + "src/index.ts", "src/hello.json" + ] +} + +//// [/src/tsconfig_withFiles.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; };" + }, + "./src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n" + }, + "./src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n" + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig_withFiles.json" + }, + "referencedMap": { + "./src/index.ts": [ + "./src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/hello.json", + "./src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/importing-json-module-from-project-reference.js b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/importing-json-module-from-project-reference.js new file mode 100644 index 00000000000..512a0f0e4a9 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/importing-json-module-from-project-reference.js @@ -0,0 +1,14 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b src/tsconfig.json --verbose +12:04:00 AM - Projects in this build: + * src/strings/tsconfig.json + * src/main/tsconfig.json + * src/tsconfig.json + +12:04:00 AM - Project 'src/strings/tsconfig.json' is up to date because newest input 'src/strings/foo.json' is older than oldest output 'src/strings/tsconfig.tsbuildinfo' + +12:04:00 AM - Project 'src/main/tsconfig.json' is up to date because newest input 'src/main/index.ts' is older than oldest output 'src/main/index.js' + +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/sourcemap.js b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/sourcemap.js new file mode 100644 index 00000000000..a5638600708 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/sourcemap.js @@ -0,0 +1,10 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b src/tsconfig_withFiles.json --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig_withFiles.json + +12:04:00 AM - Project 'src/tsconfig_withFiles.json' is up to date because newest input 'src/src/index.ts' is older than oldest output 'src/dist/src/index.js' + +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/without-outDir.js b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/without-outDir.js new file mode 100644 index 00000000000..a6329e50745 --- /dev/null +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/no-change-run/without-outDir.js @@ -0,0 +1,10 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b src/tsconfig_withFiles.json --verbose +12:04:00 AM - Projects in this build: + * src/tsconfig_withFiles.json + +12:04:00 AM - Project 'src/tsconfig_withFiles.json' is up to date because newest input 'src/src/index.ts' is older than oldest output 'src/src/index.js' + +exitCode:: ExitStatus.Success + + From 5390c644c92a0312837e236081e0e3b0d2cd628c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 12:18:16 -0700 Subject: [PATCH 11/16] rootDir tests are baselined --- .../tsbuild/referencesWithRootDirInParent.ts | 142 +++++------------- .../initial-build/builds-correctly.js | 107 +++++++++++++ ...nfo-file-because-no-rootDir-in-the-base.js | 72 +++++++++ ...reports-error-for-same-tsbuildinfo-file.js | 62 ++++++++ ...eports-no-error-when-tsbuildinfo-differ.js | 121 +++++++++++++++ 5 files changed, 403 insertions(+), 101 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/builds-correctly.js create mode 100644 tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file-because-no-rootDir-in-the-base.js create mode 100644 tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file.js create mode 100644 tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-no-error-when-tsbuildinfo-differ.js diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index d81e5f3f947..bd78954780a 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -9,113 +9,53 @@ namespace ts { projFs = undefined!; // Release the contents }); - it("verify that it builds correctly", () => { - const allExpectedOutputs = [ - "/src/dist/other/other.js", "/src/dist/other/other.d.ts", - "/src/dist/main/a.js", "/src/dist/main/a.d.ts", - "/src/dist/main/b.js", "/src/dist/main/b.d.ts" - ]; - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/src/main", "/src/src/other"], {}); - builder.build(); - host.assertDiagnosticMessages(/*empty*/); - verifyOutputsPresent(fs, allExpectedOutputs); + verifyTsc({ + scenario: "projectReferenceWithRootDirInParent", + subScenario: "builds correctly", + fs: () => projFs, + commandLineArgs: ["--b", "/src/src/main", "/src/src/other"], }); - it("verify that it reports error for same .tsbuildinfo file because no rootDir in the base", () => { - const allExpectedOutputs = [ - "/src/dist/other.js", "/src/dist/other.d.ts", - "/src/dist/tsconfig.tsbuildinfo" - ]; - const missingOutputs = [ - "/src/dist/a.js", "/src/dist/a.d.ts", - "/src/dist/b.js", "/src/dist/b.d.ts" - ]; - const fs = projFs.shadow(); - replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, ""); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"], - [Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"], - [Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"], - { - message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"], - location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{ "path": "../other" }`), - } - ); - verifyOutputsPresent(fs, allExpectedOutputs); - verifyOutputsAbsent(fs, missingOutputs); + verifyTsc({ + scenario: "projectReferenceWithRootDirInParent", + subScenario: "reports error for same tsbuildinfo file because no rootDir in the base", + fs: () => projFs, + commandLineArgs: ["--b", "/src/src/main", "--verbose"], + modifyFs: fs => replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, ""), }); - it("verify that it reports error for same .tsbuildinfo file", () => { - const allExpectedOutputs = [ - "/src/dist/other.js", "/src/dist/other.d.ts", - "/src/dist/tsconfig.tsbuildinfo" - ]; - const missingOutputs = [ - "/src/dist/a.js", "/src/dist/a.d.ts", - "/src/dist/b.js", "/src/dist/b.d.ts" - ]; - const fs = projFs.shadow(); - fs.writeFileSync("/src/src/main/tsconfig.json", JSON.stringify({ - compilerOptions: { composite: true, outDir: "../../dist/" }, - references: [{ path: "../other" }] - })); - fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({ - compilerOptions: { composite: true, outDir: "../../dist/" }, - })); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"], - [Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"], - [Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"], - { - message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"], - location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{"path":"../other"}`), - } - ); - verifyOutputsPresent(fs, allExpectedOutputs); - verifyOutputsAbsent(fs, missingOutputs); + verifyTsc({ + scenario: "projectReferenceWithRootDirInParent", + subScenario: "reports error for same tsbuildinfo file", + fs: () => projFs, + commandLineArgs: ["--b", "/src/src/main", "--verbose"], + modifyFs: fs => { + fs.writeFileSync("/src/src/main/tsconfig.json", JSON.stringify({ + compilerOptions: { composite: true, outDir: "../../dist/" }, + references: [{ path: "../other" }] + })); + fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({ + compilerOptions: { composite: true, outDir: "../../dist/" }, + })); + }, }); - it("verify that it reports no error when .tsbuildinfo differ", () => { - const allExpectedOutputs = [ - "/src/dist/other.js", "/src/dist/other.d.ts", - "/src/dist/tsconfig.main.tsbuildinfo", - "/src/dist/a.js", "/src/dist/a.d.ts", - "/src/dist/b.js", "/src/dist/b.d.ts", - "/src/dist/tsconfig.other.tsbuildinfo" - ]; - const fs = projFs.shadow(); - fs.renameSync("/src/src/main/tsconfig.json", "/src/src/main/tsconfig.main.json"); - fs.renameSync("/src/src/other/tsconfig.json", "/src/src/other/tsconfig.other.json"); - fs.writeFileSync("/src/src/main/tsconfig.main.json", JSON.stringify({ - compilerOptions: { composite: true, outDir: "../../dist/" }, - references: [{ path: "../other/tsconfig.other.json" }] - })); - fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({ - compilerOptions: { composite: true, outDir: "../../dist/" }, - })); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/src/main/tsconfig.main.json"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.other.json", "src/src/main/tsconfig.main.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.other.json", "src/dist/other.js"], - [Diagnostics.Building_project_0, "/src/src/other/tsconfig.other.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.main.json", "src/dist/a.js"], - [Diagnostics.Building_project_0, "/src/src/main/tsconfig.main.json"] - ); - verifyOutputsPresent(fs, allExpectedOutputs); + verifyTsc({ + scenario: "projectReferenceWithRootDirInParent", + subScenario: "reports no error when tsbuildinfo differ", + fs: () => projFs, + commandLineArgs: ["--b", "/src/src/main/tsconfig.main.json", "--verbose"], + modifyFs: fs => { + fs.renameSync("/src/src/main/tsconfig.json", "/src/src/main/tsconfig.main.json"); + fs.renameSync("/src/src/other/tsconfig.json", "/src/src/other/tsconfig.other.json"); + fs.writeFileSync("/src/src/main/tsconfig.main.json", JSON.stringify({ + compilerOptions: { composite: true, outDir: "../../dist/" }, + references: [{ path: "../other/tsconfig.other.json" }] + })); + fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({ + compilerOptions: { composite: true, outDir: "../../dist/" }, + })); + }, }); }); } diff --git a/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/builds-correctly.js b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/builds-correctly.js new file mode 100644 index 00000000000..be599e64928 --- /dev/null +++ b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/builds-correctly.js @@ -0,0 +1,107 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/src/main /src/src/other +exitCode:: ExitStatus.Success + + +//// [/src/dist/main/a.d.ts] +export {}; + + +//// [/src/dist/main/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var a = b_1.b; + + +//// [/src/dist/main/b.d.ts] +export declare const b = 0; + + +//// [/src/dist/main/b.js] +"use strict"; +exports.__esModule = true; +exports.b = 0; + + +//// [/src/dist/main/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; };" + }, + "../../src/main/b.ts": { + "version": "-11678562673-export const b = 0;\r\n", + "signature": "-3829176033-export declare const b = 0;\r\n" + }, + "../../src/main/a.ts": { + "version": "-17071184049-import { b } from './b';\r\nconst a = b;", + "signature": "-4882119183-export {};\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "rootDir": "../../src", + "outDir": "..", + "skipDefaultLibCheck": true, + "configFilePath": "../../src/main/tsconfig.json" + }, + "referencedMap": { + "../../src/main/a.ts": [ + "../../src/main/b.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../src/main/a.ts", + "../../src/main/b.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/dist/other/other.d.ts] +export declare const Other = 0; + + +//// [/src/dist/other/other.js] +"use strict"; +exports.__esModule = true; +exports.Other = 0; + + +//// [/src/dist/other/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; };" + }, + "../../src/other/other.ts": { + "version": "-2951227185-export const Other = 0;\r\n", + "signature": "-7996259489-export declare const Other = 0;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "rootDir": "../../src", + "outDir": "..", + "skipDefaultLibCheck": true, + "configFilePath": "../../src/other/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../src/other/other.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file-because-no-rootDir-in-the-base.js b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file-because-no-rootDir-in-the-base.js new file mode 100644 index 00000000000..1d5819876c4 --- /dev/null +++ b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file-because-no-rootDir-in-the-base.js @@ -0,0 +1,72 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/src/main --verbose +12:00:00 AM - Projects in this build: + * src/src/other/tsconfig.json + * src/src/main/tsconfig.json + +12:00:00 AM - Project 'src/src/other/tsconfig.json' is out of date because output file 'src/dist/other.js' does not exist + +12:00:00 AM - Building project '/src/src/other/tsconfig.json'... + +12:00:00 AM - Project 'src/src/main/tsconfig.json' is out of date because output file 'src/dist/a.js' does not exist + +12:00:00 AM - Building project '/src/src/main/tsconfig.json'... + +src/src/main/tsconfig.json(4,5): error TS6377: Cannot write file '/src/dist/tsconfig.tsbuildinfo' because it will overwrite '.tsbuildinfo' file generated by referenced project '/src/src/other' +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/dist/other.d.ts] +export declare const Other = 0; + + +//// [/src/dist/other.js] +"use strict"; +exports.__esModule = true; +exports.Other = 0; + + +//// [/src/dist/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; };" + }, + "../src/other/other.ts": { + "version": "-2951227185-export const Other = 0;\r\n", + "signature": "-7996259489-export declare const Other = 0;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../src/other/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/other/other.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tsconfig.base.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + + "outDir": "./dist/", + "skipDefaultLibCheck": true + }, + "exclude": [ + "node_modules" + ] +} + diff --git a/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file.js b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file.js new file mode 100644 index 00000000000..0b821f41887 --- /dev/null +++ b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-error-for-same-tsbuildinfo-file.js @@ -0,0 +1,62 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/src/main --verbose +12:00:00 AM - Projects in this build: + * src/src/other/tsconfig.json + * src/src/main/tsconfig.json + +12:00:00 AM - Project 'src/src/other/tsconfig.json' is out of date because output file 'src/dist/other.js' does not exist + +12:00:00 AM - Building project '/src/src/other/tsconfig.json'... + +12:00:00 AM - Project 'src/src/main/tsconfig.json' is out of date because output file 'src/dist/a.js' does not exist + +12:00:00 AM - Building project '/src/src/main/tsconfig.json'... + +src/src/main/tsconfig.json(1,76): error TS6377: Cannot write file '/src/dist/tsconfig.tsbuildinfo' because it will overwrite '.tsbuildinfo' file generated by referenced project '/src/src/other' +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/dist/other.d.ts] +export declare const Other = 0; + + +//// [/src/dist/other.js] +"use strict"; +exports.__esModule = true; +exports.Other = 0; + + +//// [/src/dist/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; };" + }, + "../src/other/other.ts": { + "version": "-2951227185-export const Other = 0;\r\n", + "signature": "-7996259489-export declare const Other = 0;\r\n" + } + }, + "options": { + "composite": true, + "outDir": "./", + "configFilePath": "../src/other/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/other/other.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/src/main/tsconfig.json] +{"compilerOptions":{"composite":true,"outDir":"../../dist/"},"references":[{"path":"../other"}]} + +//// [/src/src/other/tsconfig.json] +{"compilerOptions":{"composite":true,"outDir":"../../dist/"}} + diff --git a/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-no-error-when-tsbuildinfo-differ.js b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-no-error-when-tsbuildinfo-differ.js new file mode 100644 index 00000000000..7611491ff6a --- /dev/null +++ b/tests/baselines/reference/tsbuild/projectReferenceWithRootDirInParent/initial-build/reports-no-error-when-tsbuildinfo-differ.js @@ -0,0 +1,121 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/src/main/tsconfig.main.json --verbose +12:00:00 AM - Projects in this build: + * src/src/other/tsconfig.other.json + * src/src/main/tsconfig.main.json + +12:00:00 AM - Project 'src/src/other/tsconfig.other.json' is out of date because output file 'src/dist/other.js' does not exist + +12:00:00 AM - Building project '/src/src/other/tsconfig.other.json'... + +12:00:00 AM - Project 'src/src/main/tsconfig.main.json' is out of date because output file 'src/dist/a.js' does not exist + +12:00:00 AM - Building project '/src/src/main/tsconfig.main.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/dist/a.d.ts] +export {}; + + +//// [/src/dist/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var a = b_1.b; + + +//// [/src/dist/b.d.ts] +export declare const b = 0; + + +//// [/src/dist/b.js] +"use strict"; +exports.__esModule = true; +exports.b = 0; + + +//// [/src/dist/other.d.ts] +export declare const Other = 0; + + +//// [/src/dist/other.js] +"use strict"; +exports.__esModule = true; +exports.Other = 0; + + +//// [/src/dist/tsconfig.main.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; };" + }, + "../src/main/b.ts": { + "version": "-11678562673-export const b = 0;\r\n", + "signature": "-3829176033-export declare const b = 0;\r\n" + }, + "../src/main/a.ts": { + "version": "-17071184049-import { b } from './b';\r\nconst a = b;", + "signature": "-4882119183-export {};\r\n" + } + }, + "options": { + "composite": true, + "outDir": "./", + "configFilePath": "../src/main/tsconfig.main.json" + }, + "referencedMap": { + "../src/main/a.ts": [ + "../src/main/b.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/main/a.ts", + "../src/main/b.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/dist/tsconfig.other.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; };" + }, + "../src/other/other.ts": { + "version": "-2951227185-export const Other = 0;\r\n", + "signature": "-7996259489-export declare const Other = 0;\r\n" + } + }, + "options": { + "composite": true, + "outDir": "./", + "configFilePath": "../src/other/tsconfig.other.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/other/other.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/src/main/tsconfig.json] unlink +//// [/src/src/main/tsconfig.main.json] +{"compilerOptions":{"composite":true,"outDir":"../../dist/"},"references":[{"path":"../other/tsconfig.other.json"}]} + +//// [/src/src/other/tsconfig.json] unlink +//// [/src/src/other/tsconfig.other.json] +{"compilerOptions":{"composite":true,"outDir":"../../dist/"}} + From e54d5cae60af0ac6c251571f08684a61cf4b5d76 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 12:24:06 -0700 Subject: [PATCH 12/16] outFile to baseline --- src/testRunner/unittests/tsbuild/outFile.ts | 140 +++----- .../outFile/initial-build/clean-projects.js | 20 ++ .../non-module-projects-without-prepend.js | 334 ++++++++++++++++++ ...erated-when-incremental-is-set-to-false.js | 281 +++++++++++++++ ...-buildInfo-absence-results-in-new-build.js | 129 +++++++ .../outFile/no-change-run/clean-projects.js | 5 + 6 files changed, 810 insertions(+), 99 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/clean-projects.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/non-module-projects-without-prepend.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/tsbuildinfo-is-not-generated-when-incremental-is-set-to-false.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/verify-buildInfo-absence-results-in-new-build.js create mode 100644 tests/baselines/reference/tsbuild/outFile/no-change-run/clean-projects.js 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 + + From 66ea16a23a24d2e6f0262fe0a7c196807da606e7 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 12:55:58 -0700 Subject: [PATCH 13/16] Sample to baseline output --- src/testRunner/unittests/tsbuild/helpers.ts | 10 +- src/testRunner/unittests/tsbuild/sample.ts | 418 +++++------------- ...-type-only-changes-in-upstream-projects.js | 84 ++++ ...uilds-from-start-if-force-option-is-set.js | 36 ++ ...uilds-when-extended-config-file-changes.js | 84 ++++ .../rebuilds-when-tsconfig-changes.js | 97 ++++ .../Only-builds-the-leaf-node-project.js | 59 +++ ...it-would-skip-builds-during-a-dry-build.js | 11 + .../always-builds-under-with-force-option.js | 225 ++++++++++ ...rectly-when-declarationDir-is-specified.js | 227 ++++++++++ ...ilds-correctly-when-outDir-is-specified.js | 227 ++++++++++ ...composite-or-doesnt-have-any-references.js | 54 +++ .../can-detect-when-and-what-to-rebuild.js | 16 + ...ojects-if-upstream-projects-have-errors.js | 104 +++++ ...does-not-write-any-files-in-a-dry-build.js | 11 + .../sample1/initial-build/listEmittedFiles.js | 242 ++++++++++ .../sample1/initial-build/listFiles.js | 241 ++++++++++ ...uilds-when-extended-config-file-changes.js | 261 +++++++++++ .../removes-all-files-it-built.js | 19 + .../always-builds-under-with-force-option.js | 19 + .../removes-all-files-it-built.js | 5 + .../tsbuild/sample1/no-change-run/sample.js | 23 + 22 files changed, 2166 insertions(+), 307 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/Detects-type-only-changes-in-upstream-projects.js create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-from-start-if-force-option-is-set.js create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-extended-config-file-changes.js create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-tsconfig-changes.js create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/Only-builds-the-leaf-node-project.js create mode 100644 tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/indicates-that-it-would-skip-builds-during-a-dry-build.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/always-builds-under-with-force-option.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-declarationDir-is-specified.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-outDir-is-specified.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-project-is-not-composite-or-doesnt-have-any-references.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/can-detect-when-and-what-to-rebuild.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/does-not-write-any-files-in-a-dry-build.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-when-extended-config-file-changes.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/removes-all-files-it-built.js create mode 100644 tests/baselines/reference/tsbuild/sample1/no-change-run/always-builds-under-with-force-option.js create mode 100644 tests/baselines/reference/tsbuild/sample1/no-change-run/removes-all-files-it-built.js create mode 100644 tests/baselines/reference/tsbuild/sample1/no-change-run/sample.js diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index d0009de7622..cc5dd3f8556 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -279,6 +279,7 @@ interface Symbol { buildKind: BuildKind; modifyFs: (fs: vfs.FileSystem) => void; subScenario?: string; + commandLineArgs?: readonly string[]; } export interface VerifyTsBuildInput extends TscCompile { @@ -318,7 +319,12 @@ interface Symbol { verifyTscBaseline(() => sys); }); - for (const { buildKind, modifyFs, subScenario: incrementalSubScenario } of incrementalScenarios) { + for (const { + buildKind, + modifyFs, + subScenario: incrementalSubScenario, + commandLineArgs: incrementalCommandLineArgs + } of incrementalScenarios) { describe(incrementalSubScenario || buildKind, () => { let newSys: TscCompileSystem; before(() => { @@ -329,7 +335,7 @@ interface Symbol { subScenario: incrementalSubScenario || subScenario, buildKind, fs: () => sys.vfs, - commandLineArgs, + commandLineArgs: incrementalCommandLineArgs || commandLineArgs, modifyFs: fs => { tick(); modifyFs(fs); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 1a27a624197..8d3602f1bb1 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -14,123 +14,63 @@ namespace ts { projFs = undefined!; // Release the contents }); + function getSampleFsAfterBuild() { + const fs = projFs.shadow(); + const host = fakes.SolutionBuilderHost.create(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + builder.build(); + fs.makeReadonly(); + return fs; + } + describe("sanity check of clean build of 'sample1' project", () => { - it("can build the sample project 'sample1' without error", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - - host.clearDiagnostics(); - builder.build(); - host.assertDiagnosticMessages(/*empty*/); - - // Check for outputs. Not an exhaustive list - verifyOutputsPresent(fs, allExpectedOutputs); - }); - - it("builds correctly when outDir is specified", () => { - const fs = projFs.shadow(); - fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ + verifyTsc({ + scenario: "sample1", + subScenario: "builds correctly when outDir is specified", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests"], + modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, sourceMap: true, outDir: "outDir" }, references: [{ path: "../core" }] - })); - - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.build(); - host.assertDiagnosticMessages(/*empty*/); - const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/", "/logic/outDir/")); - // Check for outputs. Not an exhaustive list - verifyOutputsPresent(fs, expectedOutputs); + })), }); - it("builds correctly when declarationDir is specified", () => { - const fs = projFs.shadow(); - fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ + verifyTsc({ + scenario: "sample1", + subScenario: "builds correctly when declarationDir is specified", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests"], + modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, sourceMap: true, declarationDir: "out/decls" }, references: [{ path: "../core" }] - })); - - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.build(); - host.assertDiagnosticMessages(/*empty*/); - const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/index.d.ts", "/logic/out/decls/index.d.ts")); - // Check for outputs. Not an exhaustive list - verifyOutputsPresent(fs, expectedOutputs); + })), }); - it("builds correctly when project is not composite or doesnt have any references", () => { - const fs = projFs.shadow(); - replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, ""); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/core"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"] - ); - verifyOutputsPresent(fs, ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]); + verifyTsc({ + scenario: "sample1", + subScenario: "builds correctly when project is not composite or doesnt have any references", + fs: () => projFs, + commandLineArgs: ["--b", "/src/core", "--verbose"], + modifyFs: fs => replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, ""), }); }); describe("dry builds", () => { - it("doesn't write any files in a dry build", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false }); - builder.build(); - host.assertDiagnosticMessages( - [Diagnostics.A_non_dry_build_would_build_project_0, "/src/core/tsconfig.json"], - [Diagnostics.A_non_dry_build_would_build_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.A_non_dry_build_would_build_project_0, "/src/tests/tsconfig.json"] - ); - - // Check for outputs to not be written. Not an exhaustive list - verifyOutputsAbsent(fs, allExpectedOutputs); - }); - - it("indicates that it would skip builds during a dry build", () => { - const { fs, tick } = getFsWithTime(projFs); - const host = fakes.SolutionBuilderHost.create(fs); - - let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - builder.build(); - tick(); - - host.clearDiagnostics(); - builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false }); - builder.build(); - host.assertDiagnosticMessages( - [Diagnostics.Project_0_is_up_to_date, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date, "/src/tests/tsconfig.json"] - ); + verifyTsc({ + scenario: "sample1", + subScenario: "does not write any files in a dry build", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--dry"], }); }); describe("clean builds", () => { - it("removes all files it built", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - builder.build(); - // Verify they exist - verifyOutputsPresent(fs, allExpectedOutputs); - - builder.clean(); - // Verify they are gone - verifyOutputsAbsent(fs, allExpectedOutputs); - - // Subsequent clean shouldn't throw / etc - builder.clean(); - verifyOutputsAbsent(fs, allExpectedOutputs); - - builder.build(); - // Verify they exist - verifyOutputsPresent(fs, allExpectedOutputs); + verifyTscIncrementalEdits({ + scenario: "sample1", + subScenario: "removes all files it built", + fs: getSampleFsAfterBuild, + commandLineArgs: ["--b", "/src/tests", "--clean"], + incrementalScenarios: [noChangeRun] }); it("cleans till project specified", () => { @@ -158,29 +98,12 @@ namespace ts { }); describe("force builds", () => { - it("always builds under --force", () => { - const { fs, time, tick } = getFsWithTime(projFs); - const host = fakes.SolutionBuilderHost.create(fs); - - let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); - builder.build(); - let currentTime = time(); - checkOutputTimestamps(currentTime); - - tick(); - Debug.assert(time() !== currentTime, "Time moves on"); - currentTime = time(); - builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); - builder.build(); - checkOutputTimestamps(currentTime); - - function checkOutputTimestamps(expected: number) { - // Check timestamps - for (const output of allExpectedOutputs) { - const actual = fs.statSync(output).mtimeMs; - assert(actual === expected, `File ${output} has timestamp ${actual}, expected ${expected}`); - } - } + verifyTscIncrementalEdits({ + scenario: "sample1", + subScenario: "always builds under with force option", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--force"], + incrementalScenarios: [noChangeRun] }); }); @@ -196,64 +119,42 @@ namespace ts { return { fs, host, builder }; } - it("Builds the project", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ); - }); - - // All three projects are up to date - it("Detects that all projects are up to date", () => { - const { host, builder } = initializeWithBuild(); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"] - ); - }); - - // Update a file in the leaf node (tests), only it should rebuild the last one - it("Only builds the leaf node project", () => { - const { fs, host, builder } = initializeWithBuild(); - fs.writeFileSync("/src/tests/index.ts", "const m = 10;"); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/index.ts"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ); - }); - - // Update a file in the parent (without affecting types), should get fast downstream builds - it("Detects type-only changes in upstream projects", () => { - const { fs, host, builder } = initializeWithBuild(); - replaceText(fs, "/src/core/index.ts", "HELLO WORLD", "WELCOME PLANET"); - builder.build(); - - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/index.ts"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"], - [Diagnostics.Updating_output_timestamps_of_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"], - [Diagnostics.Updating_output_timestamps_of_project_0, "/src/tests/tsconfig.json"] - ); + verifyTscIncrementalEdits({ + scenario: "sample1", + subScenario: "can detect when and what to rebuild", + fs: getSampleFsAfterBuild, + commandLineArgs: ["--b", "/src/tests", "--verbose"], + incrementalScenarios: [ + // Update a file in the leaf node (tests), only it should rebuild the last one + { + subScenario: "Only builds the leaf node project", + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => fs.writeFileSync("/src/tests/index.ts", "const m = 10;"), + }, + // Update a file in the parent (without affecting types), should get fast downstream builds + { + subScenario: "Detects type-only changes in upstream projects", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => replaceText(fs, "/src/core/index.ts", "HELLO WORLD", "WELCOME PLANET"), + }, + { + subScenario: "indicates that it would skip builds during a dry build", + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: noop, + commandLineArgs: ["--b", "/src/tests", "--dry"], + }, + { + subScenario: "rebuilds from start if force option is set", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: noop, + commandLineArgs: ["--b", "/src/tests", "--verbose", "--force"], + }, + { + subScenario: "rebuilds when tsconfig changes", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`), + }, + ] }); it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { @@ -300,61 +201,19 @@ namespace ts { ); }); - it("rebuilds from start if --f is passed", () => { - const { host, builder } = initializeWithBuild({ force: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ); - }); - - it("rebuilds when tsconfig changes", () => { - const { fs, host, builder } = initializeWithBuild(); - replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.json"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"], - ); - }); - - it("rebuilds when extended config file changes", () => { - const { fs, tick } = getFsWithTime(projFs); - fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } })); - replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`); - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ); - host.clearDiagnostics(); - tick(); - builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], - [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], - [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.base.json"], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] - ); + verifyTscIncrementalEdits({ + scenario: "sample1", + subScenario: "rebuilds when extended config file changes", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--verbose"], + modifyFs: fs => { + fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } })); + replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`); + }, + incrementalScenarios: [{ + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })) + }] }); it("builds till project specified", () => { @@ -435,27 +294,12 @@ namespace ts { }); describe("downstream-blocked compilations", () => { - it("won't build downstream projects if upstream projects have errors", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: true }); - - // Induce an error in the middle project - replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`); - builder.build(); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - { - message: [Diagnostics.Property_0_does_not_exist_on_type_1, "muitply", `typeof import("/src/core/index")`], - location: expectedLocationIndexOf(fs, "/src/logic/index.ts", "muitply"), - }, - [Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/tests/tsconfig.json", "src/logic"], - [Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/tests/tsconfig.json", "/src/logic"] - ); + verifyTsc({ + scenario: "sample1", + subScenario: "does not build downstream projects if upstream projects have errors", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--verbose"], + modifyFs: fs => replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`) }); }); @@ -515,54 +359,17 @@ export class cNew {}`); }); describe("lists files", () => { - it("listFiles", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { listFiles: true }); - builder.build(); - assert.deepEqual(host.traces, [ - "/lib/lib.d.ts", - "/src/core/anotherModule.ts", - "/src/core/index.ts", - "/src/core/some_decl.d.ts", - "/lib/lib.d.ts", - ...getCoreOutputs(), - "/src/logic/index.ts", - "/lib/lib.d.ts", - ...getCoreOutputs(), - "/src/logic/index.d.ts", - "/src/tests/index.ts" - ]); - - function getCoreOutputs() { - return [ - "/src/core/index.d.ts", - "/src/core/anotherModule.d.ts" - ]; - } + verifyTsc({ + scenario: "sample1", + subScenario: "listFiles", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--listFiles"], }); - - it("listEmittedFiles", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { listEmittedFiles: true }); - builder.build(); - assert.deepEqual(host.traces, [ - "TSFILE: /src/core/anotherModule.js", - "TSFILE: /src/core/anotherModule.d.ts.map", - "TSFILE: /src/core/anotherModule.d.ts", - "TSFILE: /src/core/index.js", - "TSFILE: /src/core/index.d.ts.map", - "TSFILE: /src/core/index.d.ts", - "TSFILE: /src/core/tsconfig.tsbuildinfo", - "TSFILE: /src/logic/index.js.map", - "TSFILE: /src/logic/index.js", - "TSFILE: /src/logic/index.d.ts", - "TSFILE: /src/logic/tsconfig.tsbuildinfo", - "TSFILE: /src/tests/index.js", - "TSFILE: /src/tests/index.d.ts", - "TSFILE: /src/tests/tsconfig.tsbuildinfo", - ]); + verifyTsc({ + scenario: "sample1", + subScenario: "listEmittedFiles", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"], }); }); @@ -590,7 +397,8 @@ class someClass { }`), buildKind: BuildKind.IncrementalDtsChange, modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true, "declarationDir": "decls",`), - } + }, + noChangeRun, ], }); diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/Detects-type-only-changes-in-upstream-projects.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/Detects-type-only-changes-in-upstream-projects.js new file mode 100644 index 00000000000..7a6fd10afad --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/Detects-type-only-changes-in-upstream-projects.js @@ -0,0 +1,84 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:08:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:08:00 AM - Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/index.ts' + +12:08:00 AM - Building project '/src/core/tsconfig.json'... + +12:08:00 AM - Updating unchanged output timestamps of project '/src/core/tsconfig.json'... + +12:08:00 AM - Project 'src/logic/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:08:00 AM - Updating output timestamps of project '/src/logic/tsconfig.json'... + +12:08:00 AM - Project 'src/tests/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:08:00 AM - Updating output timestamps of project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAyB,CAAC;AACnD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "WELCOME PLANET"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/index.ts] +export const someString: string = "WELCOME PLANET"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-2157245566-export const someString: string = \"WELCOME PLANET\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-from-start-if-force-option-is-set.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-from-start-if-force-option-is-set.js new file mode 100644 index 00000000000..1d1428887aa --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-from-start-if-force-option-is-set.js @@ -0,0 +1,36 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose --force +12:16:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:16:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:16:00 AM - Building project '/src/core/tsconfig.json'... + +12:16:00 AM - Project 'src/logic/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:16:00 AM - Building project '/src/logic/tsconfig.json'... + +12:16:00 AM - Project 'src/tests/tsconfig.json' is up to date with .d.ts files from its dependencies + +12:16:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] file written with same contents +//// [/src/core/anotherModule.d.ts.map] file written with same contents +//// [/src/core/anotherModule.js] file written with same contents +//// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] file written with same contents +//// [/src/core/index.js] file written with same contents +//// [/src/core/tsconfig.tsbuildinfo] file written with same contents +//// [/src/logic/index.d.ts] file written with same contents +//// [/src/logic/index.js] file written with same contents +//// [/src/logic/index.js.map] file written with same contents +//// [/src/logic/tsconfig.tsbuildinfo] file written with same contents +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.tsbuildinfo] file written with same contents diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-extended-config-file-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-extended-config-file-changes.js new file mode 100644 index 00000000000..ff22ad2e032 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-extended-config-file-changes.js @@ -0,0 +1,84 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:04:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:04:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/tests/tsconfig.base.json' + +12:04:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.base.json] +{"compilerOptions":{}} + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-tsconfig-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-tsconfig-changes.js new file mode 100644 index 00000000000..577edf20fe5 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/rebuilds-when-tsconfig-changes.js @@ -0,0 +1,97 @@ +//// [/lib/incremental-declaration-changesOutput.txt] +/lib/tsc --b /src/tests --verbose +12:20:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:20:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:20:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:20:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/tests/tsconfig.json' + +12:20:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, "target": "es3", + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "target": 0, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/Only-builds-the-leaf-node-project.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/Only-builds-the-leaf-node-project.js new file mode 100644 index 00000000000..74ee0a5d2c8 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/Only-builds-the-leaf-node-project.js @@ -0,0 +1,59 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/tests --verbose +12:04:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:04:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:04:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:04:00 AM - Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/tests/index.ts' + +12:04:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/tests/index.d.ts] +declare const m = 10; + + +//// [/src/tests/index.js] +var m = 10; + + +//// [/src/tests/index.ts] +const m = 10; + +//// [/src/tests/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; };" + }, + "./index.ts": { + "version": "3708260210-const m = 10;", + "signature": "1073907769-declare const m = 10;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/indicates-that-it-would-skip-builds-during-a-dry-build.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/indicates-that-it-would-skip-builds-during-a-dry-build.js new file mode 100644 index 00000000000..3e323c17d3e --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/indicates-that-it-would-skip-builds-during-a-dry-build.js @@ -0,0 +1,11 @@ +//// [/lib/incremental-declaration-doesnt-changeOutput.txt] +/lib/tsc --b /src/tests --dry +12:12:00 AM - Project '/src/core/tsconfig.json' is up to date + +12:12:00 AM - Project '/src/logic/tsconfig.json' is up to date + +12:12:00 AM - Project '/src/tests/tsconfig.json' is up to date + +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/always-builds-under-with-force-option.js b/tests/baselines/reference/tsbuild/sample1/initial-build/always-builds-under-with-force-option.js new file mode 100644 index 00000000000..7184dc584e6 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/always-builds-under-with-force-option.js @@ -0,0 +1,225 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --force +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-declarationDir-is-specified.js b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-declarationDir-is-specified.js new file mode 100644 index 00000000000..6f9e05fdb69 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-declarationDir-is-specified.js @@ -0,0 +1,227 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/out/decls/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true,"sourceMap":true,"declarationDir":"out/decls"},"references":[{"path":"../core"}]} + +//// [/src/logic/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "declarationDir": "./out/decls", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/out/decls/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-outDir-is-specified.js b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-outDir-is-specified.js new file mode 100644 index 00000000000..b61004ba7b1 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-outDir-is-specified.js @@ -0,0 +1,227 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/outDir/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/outDir/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/outDir/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/outDir/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; };" + }, + "../../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "outDir": "./", + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../../core/anothermodule.d.ts", + "../../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../core/anothermodule.ts", + "../../core/index.ts", + "../index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true,"sourceMap":true,"outDir":"outDir"},"references":[{"path":"../core"}]} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/outdir/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-project-is-not-composite-or-doesnt-have-any-references.js b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-project-is-not-composite-or-doesnt-have-any-references.js new file mode 100644 index 00000000000..78aae297847 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-correctly-when-project-is-not-composite-or-doesnt-have-any-references.js @@ -0,0 +1,54 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/core --verbose +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + +12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:00:00 AM - Building project '/src/core/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/can-detect-when-and-what-to-rebuild.js b/tests/baselines/reference/tsbuild/sample1/initial-build/can-detect-when-and-what-to-rebuild.js new file mode 100644 index 00000000000..e10434fa082 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/can-detect-when-and-what-to-rebuild.js @@ -0,0 +1,16 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:01:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:01:00 AM - Project 'src/tests/tsconfig.json' is up to date because newest input 'src/tests/index.ts' is older than oldest output 'src/tests/index.js' + +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js new file mode 100644 index 00000000000..4e5f349c0a1 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js @@ -0,0 +1,104 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:00:00 AM - Building project '/src/core/tsconfig.json'... + +12:00:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +12:00:00 AM - Building project '/src/logic/tsconfig.json'... + +src/logic/index.ts(3,14): error TS2339: Property 'muitply' does not exist on type 'typeof import("/src/core/index")'. +12:00:00 AM - Project 'src/tests/tsconfig.json' can't be built because its dependency 'src/logic' has errors + +12:00:00 AM - Skipping build of project '/src/tests/tsconfig.json' because its dependency '/src/logic' has errors + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.muitply(); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-write-any-files-in-a-dry-build.js b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-write-any-files-in-a-dry-build.js new file mode 100644 index 00000000000..660696d2437 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-write-any-files-in-a-dry-build.js @@ -0,0 +1,11 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --dry +12:00:00 AM - A non-dry build would build project '/src/core/tsconfig.json' + +12:00:00 AM - A non-dry build would build project '/src/logic/tsconfig.json' + +12:00:00 AM - A non-dry build would build project '/src/tests/tsconfig.json' + +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js new file mode 100644 index 00000000000..e9fb72c132e --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js @@ -0,0 +1,242 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --listEmittedFiles +TSFILE: /src/core/anotherModule.js +TSFILE: /src/core/anotherModule.d.ts.map +TSFILE: /src/core/anotherModule.d.ts +TSFILE: /src/core/index.js +TSFILE: /src/core/index.d.ts.map +TSFILE: /src/core/index.d.ts +TSFILE: /src/core/tsconfig.tsbuildinfo +TSFILE: /src/logic/index.js.map +TSFILE: /src/logic/index.js +TSFILE: /src/logic/index.d.ts +TSFILE: /src/logic/tsconfig.tsbuildinfo +TSFILE: /src/tests/index.js +TSFILE: /src/tests/index.d.ts +TSFILE: /src/tests/tsconfig.tsbuildinfo +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "listEmittedFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "listEmittedFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "listEmittedFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js new file mode 100644 index 00000000000..9e44bb99bd4 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js @@ -0,0 +1,241 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --listFiles +/lib/lib.d.ts +/src/core/anotherModule.ts +/src/core/index.ts +/src/core/some_decl.d.ts +/lib/lib.d.ts +/src/core/index.d.ts +/src/core/anotherModule.d.ts +/src/logic/index.ts +/lib/lib.d.ts +/src/core/index.d.ts +/src/core/anotherModule.d.ts +/src/logic/index.d.ts +/src/tests/index.ts +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "listFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "listFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "listFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-when-extended-config-file-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-when-extended-config-file-changes.js new file mode 100644 index 00000000000..d36e53f292e --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-when-extended-config-file-changes.js @@ -0,0 +1,261 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --verbose +12:01:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:01:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +12:01:00 AM - Building project '/src/core/tsconfig.json'... + +12:01:00 AM - Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +12:01:00 AM - Building project '/src/logic/tsconfig.json'... + +12:01:00 AM - Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +12:01:00 AM - Building project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/tsconfig.base.json] +{"compilerOptions":{"target":"es3"}} + +//// [/src/tests/tsconfig.json] +{ + "extends": "./tsconfig.base.json", "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/tests/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; };" + }, + "../core/index.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" + } + }, + "options": { + "target": 0, + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/removes-all-files-it-built.js b/tests/baselines/reference/tsbuild/sample1/initial-build/removes-all-files-it-built.js new file mode 100644 index 00000000000..de8181610b6 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/removes-all-files-it-built.js @@ -0,0 +1,19 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --b /src/tests --clean +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] unlink +//// [/src/core/anotherModule.d.ts.map] unlink +//// [/src/core/anotherModule.js] unlink +//// [/src/core/index.d.ts] unlink +//// [/src/core/index.d.ts.map] unlink +//// [/src/core/index.js] unlink +//// [/src/core/tsconfig.tsbuildinfo] unlink +//// [/src/logic/index.d.ts] unlink +//// [/src/logic/index.js] unlink +//// [/src/logic/index.js.map] unlink +//// [/src/logic/tsconfig.tsbuildinfo] unlink +//// [/src/tests/index.d.ts] unlink +//// [/src/tests/index.js] unlink +//// [/src/tests/tsconfig.tsbuildinfo] unlink diff --git a/tests/baselines/reference/tsbuild/sample1/no-change-run/always-builds-under-with-force-option.js b/tests/baselines/reference/tsbuild/sample1/no-change-run/always-builds-under-with-force-option.js new file mode 100644 index 00000000000..447a8dbcc1f --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/no-change-run/always-builds-under-with-force-option.js @@ -0,0 +1,19 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b /src/tests --force +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] file written with same contents +//// [/src/core/anotherModule.d.ts.map] file written with same contents +//// [/src/core/anotherModule.js] file written with same contents +//// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] file written with same contents +//// [/src/core/index.js] file written with same contents +//// [/src/core/tsconfig.tsbuildinfo] file written with same contents +//// [/src/logic/index.d.ts] file written with same contents +//// [/src/logic/index.js] file written with same contents +//// [/src/logic/index.js.map] file written with same contents +//// [/src/logic/tsconfig.tsbuildinfo] file written with same contents +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.tsbuildinfo] file written with same contents diff --git a/tests/baselines/reference/tsbuild/sample1/no-change-run/removes-all-files-it-built.js b/tests/baselines/reference/tsbuild/sample1/no-change-run/removes-all-files-it-built.js new file mode 100644 index 00000000000..b0b052304a2 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/no-change-run/removes-all-files-it-built.js @@ -0,0 +1,5 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b /src/tests --clean +exitCode:: ExitStatus.Success + + diff --git a/tests/baselines/reference/tsbuild/sample1/no-change-run/sample.js b/tests/baselines/reference/tsbuild/sample1/no-change-run/sample.js new file mode 100644 index 00000000000..8304e0bf57c --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/no-change-run/sample.js @@ -0,0 +1,23 @@ +//// [/lib/no-change-runOutput.txt] +/lib/tsc --b /src/tests --verbose +12:16:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +12:16:00 AM - Project 'src/core/tsconfig.json' is up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:16:00 AM - Project 'src/logic/tsconfig.json' is up to date because newest input 'src/logic/index.ts' is older than oldest output 'src/logic/index.js' + +12:16:00 AM - Project 'src/tests/tsconfig.json' is up to date because newest input 'src/tests/index.ts' is older than oldest output 'src/tests/index.js' + +exitCode:: ExitStatus.Success +readFiles:: { + "/src/tests/tsconfig.json": 1, + "/src/core/tsconfig.json": 1, + "/src/logic/tsconfig.json": 1, + "/src/core/tsconfig.tsbuildinfo": 1, + "/src/logic/tsconfig.tsbuildinfo": 1, + "/src/tests/tsconfig.tsbuildinfo": 1 +} + From 1531c9ec21baa85f26f07a416374e3c6371453b8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 16 Oct 2019 15:42:53 -0700 Subject: [PATCH 14/16] Fix lint rules --- src/testRunner/unittests/tsc/helpers.ts | 2 +- src/tsc/executeCommandLine.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 6de4a4f08b6..ed3ac65cc96 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -60,7 +60,7 @@ namespace ts { sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`); sys.exit = exitCode => sys.exitCode = exitCode; - ts.executeCommandLine( + executeCommandLine( sys, { onCompilerHostCreate: host => fakes.patchHostForBuildInfoReadWrite(host), diff --git a/src/tsc/executeCommandLine.ts b/src/tsc/executeCommandLine.ts index 1496ac39931..bd3a00efdc3 100644 --- a/src/tsc/executeCommandLine.ts +++ b/src/tsc/executeCommandLine.ts @@ -605,8 +605,8 @@ namespace ts { createWatchProgram(watchCompilerHost); } - function canReportDiagnostics(sys: System, compilerOptions: CompilerOptions) { - return sys === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics); + function canReportDiagnostics(system: System, compilerOptions: CompilerOptions) { + return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics); } function enableStatistics(sys: System, compilerOptions: CompilerOptions) { From 6caa92800fab095d2416826a42fcf344f5860366 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 17 Oct 2019 12:00:41 -0700 Subject: [PATCH 15/16] Fix scenario name --- src/testRunner/unittests/tsbuild/demo.ts | 2 +- ...nch-with-everything-setup-correctly-and-reports-no-error.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/baselines/reference/tsbuild/demo/initial-build/{in-master-branch-with-everything-setup-correctly,-reports-no-error.js => in-master-branch-with-everything-setup-correctly-and-reports-no-error.js} (100%) diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index afdf7f5d6bf..18bc1eea89a 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -11,7 +11,7 @@ namespace ts { verifyTsc({ scenario: "demo", - subScenario: "in master branch with everything setup correctly, reports no error", + subScenario: "in master branch with everything setup correctly and reports no error", fs: () => projFs, commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"] }); diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly-and-reports-no-error.js similarity index 100% rename from tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly,-reports-no-error.js rename to tests/baselines/reference/tsbuild/demo/initial-build/in-master-branch-with-everything-setup-correctly-and-reports-no-error.js From 4530d3ed806a4ccb18f2d82751c1f5ac2fae4b6e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 17 Oct 2019 12:04:24 -0700 Subject: [PATCH 16/16] Fixed scenario names --- .../unittests/tsbuild/emptyFiles.ts | 4 +- ...es-is-empty-and-references-are-provided.js | 49 +++++++++++++++++-- ...is-empty-and-no-references-are-provided.js | 49 ++----------------- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index 9740893bdb6..ffd9429a344 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -10,14 +10,14 @@ namespace ts { verifyTsc({ scenario: "emptyFiles", - subScenario: "does not have empty files diagnostic when files is empty and references are provided", + subScenario: "has empty files diagnostic when files is empty and no references are provided", fs: () => projFs, commandLineArgs: ["--b", "/src/no-references"], }); verifyTsc({ scenario: "emptyFiles", - subScenario: "has empty files diagnostic when files is empty and no references are provided", + subScenario: "does not have empty files diagnostic when files is empty and references are provided", fs: () => projFs, commandLineArgs: ["--b", "/src/with-references"], }); diff --git a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js index 6db6e8fe608..8760280f3de 100644 --- a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js +++ b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js @@ -1,6 +1,49 @@ //// [/lib/initial-buildOutput.txt] -/lib/tsc --b /src/no-references -src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty. -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +/lib/tsc --b /src/with-references +exitCode:: ExitStatus.Success +//// [/src/core/index.d.ts] +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/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; };" + }, + "./index.ts": { + "version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js index 8760280f3de..6db6e8fe608 100644 --- a/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js +++ b/tests/baselines/reference/tsbuild/emptyFiles/initial-build/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js @@ -1,49 +1,6 @@ //// [/lib/initial-buildOutput.txt] -/lib/tsc --b /src/with-references -exitCode:: ExitStatus.Success +/lib/tsc --b /src/no-references +src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -//// [/src/core/index.d.ts] -export declare function multiply(a: number, b: number): number; -//# sourceMappingURL=index.d.ts.map - -//// [/src/core/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} - -//// [/src/core/index.js] -"use strict"; -exports.__esModule = true; -function multiply(a, b) { return a * b; } -exports.multiply = multiply; - - -//// [/src/core/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; };" - }, - "./index.ts": { - "version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n", - "signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" - } - }, - "options": { - "composite": true, - "declaration": true, - "declarationMap": true, - "skipDefaultLibCheck": true, - "configFilePath": "./tsconfig.json" - }, - "referencedMap": {}, - "exportedModulesMap": {}, - "semanticDiagnosticsPerFile": [ - "../../lib/lib.d.ts", - "./index.ts" - ] - }, - "version": "FakeTSVersion" -} -