From 880907fddbce65bb14c28cc8dcf0faaa5bb3a531 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 30 Mar 2022 12:39:49 -0700 Subject: [PATCH 1/3] Some refactoring for baselining for easy update --- src/executeCommandLine/executeCommandLine.ts | 2 +- src/harness/fakesHosts.ts | 21 +- .../unittests/tsbuild/amdModulesWithOut.ts | 54 +- src/testRunner/unittests/tsbuild/outFile.ts | 322 ++---- src/testRunner/unittests/tsbuild/sample.ts | 345 +++--- .../unittests/tsbuildWatch/programUpdates.ts | 154 +-- .../unittests/tsbuildWatch/publicApi.ts | 13 +- .../tsbuildWatch/watchEnvironment.ts | 104 +- src/testRunner/unittests/tsc/helpers.ts | 155 +-- .../unittests/tscWatch/consoleClearing.ts | 6 +- src/testRunner/unittests/tscWatch/helpers.ts | 285 ++--- .../unittests/tscWatch/incremental.ts | 3 +- .../unittests/tscWatch/programUpdates.ts | 70 +- .../unittests/tscWatch/resolutionCache.ts | 258 +++-- .../sourceOfProjectReferenceRedirect.ts | 54 +- src/testRunner/unittests/tscWatch/watchApi.ts | 408 ++++--- .../builds-till-project-specified.js | 157 +++ .../cleans-till-project-specified.js | 142 +++ ...al-flag-changes-between-non-dts-changes.js | 1020 +++++++++++++++++ ...-in-tsbuildinfo-doesnt-match-ts-version.js | 250 ++++ ...uilding-using-getNextInvalidatedProject.js | 188 +++ ...t-in-not-build-order-doesnt-throw-error.js | 72 ++ .../building-using-buildReferencedProject.js | 169 +++ .../builds-till-project-specified.js | 157 +++ ...t-in-not-build-order-doesnt-throw-error.js | 83 ++ .../cleans-till-project-specified.js | 83 ++ ...vent-if-version-doesnt-match-ts-version.js | 125 ++ ...-in-tsbuildinfo-doesnt-match-ts-version.js | 191 +++ .../sample1/invalidates-projects-correctly.js | 270 +++++ ...-references-watches-only-those-projects.js | 340 ++++++ ...e-projects-with-single-watcher-per-file.js | 555 +++++++++ .../same-file-in-multiple-projects.js | 565 +++++++++ .../createWatchOfConfigFile.js | 9 +- ...should-support-files-without-extensions.js | 58 + ...programs-are-not-affected-by-each-other.js | 157 +++ .../tscWatch/resolutionCache/caching-works.js | 275 +++++ .../loads-missing-files-from-disk.js | 124 ++ ...module-goes-missing-and-then-comes-back.js | 171 +++ ...es-field-when-solution-is-already-built.js | 212 ++++ ...Symlinks-when-solution-is-already-built.js | 212 ++++ ...n-has-types-field-with-preserveSymlinks.js | 187 +++ ...-package-when-solution-is-already-built.js | 212 ++++ ...Symlinks-when-solution-is-already-built.js | 212 ++++ ...th-scoped-package-with-preserveSymlinks.js | 187 +++ ...son-has-types-field-with-scoped-package.js | 187 +++ .../when-packageJson-has-types-field.js | 187 +++ ...ubFolder-when-solution-is-already-built.js | 214 ++++ ...Symlinks-when-solution-is-already-built.js | 214 ++++ ...le-from-subFolder-with-preserveSymlinks.js | 189 +++ ...-package-when-solution-is-already-built.js | 214 ++++ ...Symlinks-when-solution-is-already-built.js | 214 ++++ ...th-scoped-package-with-preserveSymlinks.js | 189 +++ ...file-from-subFolder-with-scoped-package.js | 189 +++ .../when-referencing-file-from-subFolder.js | 189 +++ ...-project-when-solution-is-already-built.js | 345 ++++++ .../with-simple-project.js | 316 +++++ .../extraFileExtensions-are-supported.js | 134 +++ ...noEmit-with-composite-with-emit-builder.js | 522 +++++++++ ...it-with-composite-with-semantic-builder.js | 559 +++++++++ ...nError-with-composite-with-emit-builder.js | 376 ++++++ ...or-with-composite-with-semantic-builder.js | 407 +++++++ ...createSemanticDiagnosticsBuilderProgram.js | 122 ++ ...n-works-when-returned-without-extension.js | 84 ++ ...assed-down-to-the-watch-status-reporter.js | 81 ++ ...ing-useSourceOfProjectReferenceRedirect.js | 213 +++- ...-host-implementing-getParsedCommandLine.js | 103 +- ...-timesouts-on-host-program-gets-updated.js | 122 ++ 67 files changed, 12804 insertions(+), 1203 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/builds-till-project-specified.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/cleans-till-project-specified.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-command-line-incremental-flag-changes-between-non-dts-changes.js create mode 100644 tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js create mode 100644 tests/baselines/reference/tsbuild/sample1/building-using-getNextInvalidatedProject.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/building-project-in-not-build-order-doesnt-throw-error.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/building-using-buildReferencedProject.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/builds-till-project-specified.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/cleaning-project-in-not-build-order-doesnt-throw-error.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/cleans-till-project-specified.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/does-not-rebuild-if-there-is-no-program-and-bundle-in-the-ts-build-info-event-if-version-doesnt-match-ts-version.js create mode 100644 tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js create mode 100644 tests/baselines/reference/tsbuild/sample1/invalidates-projects-correctly.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/verify-building-references-watches-only-those-projects.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects-with-single-watcher-per-file.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-support-files-without-extensions.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/two-watch-programs-are-not-affected-by-each-other.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/caching-works.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/loads-missing-files-from-disk.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/should-compile-correctly-when-resolved-module-goes-missing-and-then-comes-back.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project-when-solution-is-already-built.js create mode 100644 tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/extraFileExtensions-are-supported.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-emit-builder.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-semantic-builder.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-emit-builder.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-semantic-builder.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/verifies-that-noEmit-is-handled-on-createSemanticDiagnosticsBuilderProgram.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/verify-that-the-error-count-is-correctly-passed-down-to-the-watch-status-reporter.js create mode 100644 tests/baselines/reference/tscWatch/watchApi/without-timesouts-on-host-program-gets-updated.js diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index a7d776acd802f..68d2e51e9d4eb 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -649,7 +649,7 @@ namespace ts { return false; } - export type ExecuteCommandLineCallbacks = (program: Program | EmitAndSemanticDiagnosticsBuilderProgram | ParsedCommandLine) => void; + export type ExecuteCommandLineCallbacks = (program: Program | BuilderProgram | ParsedCommandLine) => void; export function executeCommandLine( system: System, cb: ExecuteCommandLineCallbacks, diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 58b29a4c7ef98..b1fc0e69c6547 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -511,18 +511,19 @@ ${indentText}${text}`; buildInfo.version = ts.version; return ts.getBuildInfoText(buildInfo); }; + return patchHostForBuildInfoWrite(sys, version); + } + + export function patchHostForBuildInfoWrite(sys: T, version: string) { const originalWrite = sys.write; sys.write = msg => originalWrite.call(sys, msg.replace(ts.version, version)); - - if (sys.writeFile) { - const originalWriteFile = sys.writeFile; - sys.writeFile = (fileName: string, content: string, writeByteOrderMark: boolean) => { - if (!ts.isBuildInfoFile(fileName)) return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); - const buildInfo = ts.getBuildInfo(content); - buildInfo.version = version; - originalWriteFile.call(sys, fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); - }; - } + const originalWriteFile = sys.writeFile; + sys.writeFile = (fileName: string, content: string, writeByteOrderMark: boolean) => { + if (!ts.isBuildInfoFile(fileName)) return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); + const buildInfo = ts.getBuildInfo(content); + buildInfo.version = version; + originalWriteFile.call(sys, fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); + }; return sys; } diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index a08365887de0a..428a433de44d9 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -1,30 +1,6 @@ namespace ts { describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { let outFileFs: vfs.FileSystem; - const enum Project { lib, app } - function relName(path: string) { - return path.slice(1); - } - type Sources = [string, readonly string[]]; - const enum Source { config, ts } - const sources: [Sources, Sources] = [ - [ - "/src/lib/tsconfig.json", - [ - "/src/lib/file0.ts", - "/src/lib/file1.ts", - "/src/lib/file2.ts", - "/src/lib/global.ts", - ] - ], - [ - "/src/app/tsconfig.json", - [ - "/src/app/file3.ts", - "/src/app/file4.ts" - ] - ] - ]; before(() => { outFileFs = loadProjectFromDisk("tests/projects/amdModulesWithOut"); }); @@ -53,7 +29,7 @@ namespace ts { incrementalScenarios: [ { buildKind: BuildKind.IncrementalDtsUnchanged, - modifyFs: fs => appendText(fs, relName(sources[Project.lib][Source.ts][1]), "console.log(x);") + modifyFs: fs => appendText(fs, "/src/lib/file1.ts", "console.log(x);") }, ...(modifyAgainFs ? [{ buildKind: BuildKind.IncrementalHeadersChange, @@ -73,15 +49,15 @@ namespace ts { verifyOutFileScenario({ subScenario: "multiple prologues in all projects", modifyFs: fs => { - enableStrict(fs, sources[Project.lib][Source.config]); - addTestPrologue(fs, sources[Project.lib][Source.ts][0], `"myPrologue"`); - addTestPrologue(fs, sources[Project.lib][Source.ts][2], `"myPrologueFile"`); - addTestPrologue(fs, sources[Project.lib][Source.ts][3], `"myPrologue3"`); - enableStrict(fs, sources[Project.app][Source.config]); - addTestPrologue(fs, sources[Project.app][Source.ts][0], `"myPrologue"`); - addTestPrologue(fs, sources[Project.app][Source.ts][1], `"myPrologue2";`); + enableStrict(fs, "/src/lib/tsconfig.json"); + addTestPrologue(fs, "/src/lib/file0.ts", `"myPrologue"`); + addTestPrologue(fs, "/src/lib/file2.ts", `"myPrologueFile"`); + addTestPrologue(fs, "/src/lib/global.ts", `"myPrologue3"`); + enableStrict(fs, "/src/app/tsconfig.json"); + addTestPrologue(fs, "/src/app/file3.ts", `"myPrologue"`); + addTestPrologue(fs, "/src/app/file4.ts", `"myPrologue2";`); }, - modifyAgainFs: fs => addTestPrologue(fs, relName(sources[Project.lib][Source.ts][1]), `"myPrologue5"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/lib/file1.ts", `"myPrologue5"`) }); }); @@ -127,10 +103,10 @@ namespace ts { describe("stripInternal", () => { function stripInternalScenario(fs: vfs.FileSystem) { const internal = "/*@internal*/"; - replaceText(fs, sources[Project.app][Source.config], `"composite": true,`, `"composite": true, + replaceText(fs, "/src/app/tsconfig.json", `"composite": true,`, `"composite": true, "stripInternal": true,`); - replaceText(fs, sources[Project.lib][Source.ts][0], "const", `${internal} const`); - appendText(fs, sources[Project.lib][Source.ts][1], ` + replaceText(fs, "/src/lib/file0.ts", "const", `${internal} const`); + appendText(fs, "/src/lib/file1.ts", ` export class normalC { ${internal} constructor() { } ${internal} prop: string; @@ -162,16 +138,16 @@ ${internal} export enum internalEnum { a, b, c }`); verifyOutFileScenario({ subScenario: "stripInternal", modifyFs: stripInternalScenario, - modifyAgainFs: fs => replaceText(fs, sources[Project.lib][Source.ts][1], `export const`, `/*@internal*/ export const`), + modifyAgainFs: fs => replaceText(fs, "/src/lib/file1.ts", `export const`, `/*@internal*/ export const`), }); }); describe("when the module resolution finds original source file", () => { function modifyFs(fs: vfs.FileSystem) { // Make lib to output to parent dir - replaceText(fs, sources[Project.lib][Source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`); + replaceText(fs, "/src/lib/tsconfig.json", `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`); // Change reference to file1 module to resolve to lib/file1 - replaceText(fs, sources[Project.app][Source.ts][0], "file1", "lib/file1"); + replaceText(fs, "/src/app/file3.ts", "file1", "lib/file1"); } verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 33f7705085258..eff6b03e93d88 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -1,78 +1,11 @@ namespace ts { describe("unittests:: tsbuild:: outFile::", () => { let outFileFs: vfs.FileSystem; - const enum Ext { js, jsmap, dts, dtsmap, buildinfo } - const enum Project { first, second, third } - type OutputFile = [string, string, string, string, string]; - function relName(path: string) { - return path.slice(1); - } - const outputFiles: [OutputFile, OutputFile, OutputFile] = [ - [ - "/src/first/bin/first-output.js", - "/src/first/bin/first-output.js.map", - "/src/first/bin/first-output.d.ts", - "/src/first/bin/first-output.d.ts.map", - "/src/first/bin/first-output.tsbuildinfo" - ], - [ - "/src/2/second-output.js", - "/src/2/second-output.js.map", - "/src/2/second-output.d.ts", - "/src/2/second-output.d.ts.map", - "/src/2/second-output.tsbuildinfo" - ], - [ - "/src/third/thirdjs/output/third-output.js", - "/src/third/thirdjs/output/third-output.js.map", - "/src/third/thirdjs/output/third-output.d.ts", - "/src/third/thirdjs/output/third-output.d.ts.map", - "/src/third/thirdjs/output/third-output.tsbuildinfo" - ] - ]; - const relOutputFiles = outputFiles.map(v => v.map(relName)) as [OutputFile, OutputFile, OutputFile]; - type Sources = [string, readonly string[]]; - const enum Source { config, ts } - const enum Part { one, two, three } - const sources: [Sources, Sources, Sources] = [ - [ - "/src/first/tsconfig.json", - [ - "/src/first/first_PART1.ts", - "/src/first/first_part2.ts", - "/src/first/first_part3.ts" - ] - ], - [ - "/src/second/tsconfig.json", - [ - "/src/second/second_part1.ts", - "/src/second/second_part2.ts" - ] - ], - [ - "/src/third/tsconfig.json", - [ - "/src/third/third_part1.ts" - ] - ] - ]; - const relSources = sources.map(([config, sources]) => [relName(config), sources.map(relName)]) as any as [Sources, Sources, Sources]; - 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]], - [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], relOutputFiles[Project.second][Ext.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], relOutputFiles[Project.third][Ext.js]], - [Diagnostics.Building_project_0, sources[Project.third][Source.config]] - ]; before(() => { outFileFs = loadProjectFromDisk("tests/projects/outfile-concat"); }); after(() => { outFileFs = undefined!; - initialExpectedDiagnostics = undefined!; }); function createSolutionBuilder(host: fakes.SolutionBuilderHost, baseOptions?: BuildOptions) { @@ -102,13 +35,13 @@ namespace ts { if (!ignoreDtsChanged) { incrementalScenarios.push({ buildKind: BuildKind.IncrementalDtsChange, - modifyFs: fs => replaceText(fs, relSources[Project.first][Source.ts][Part.one], "Hello", "Hola"), + modifyFs: fs => replaceText(fs, "/src/first/first_PART1.ts", "Hello", "Hola"), }); } if (!ignoreDtsUnchanged) { incrementalScenarios.push({ buildKind: BuildKind.IncrementalDtsUnchanged, - modifyFs: fs => appendText(fs, relSources[Project.first][Source.ts][Part.one], "console.log(s);"), + modifyFs: fs => appendText(fs, "/src/first/first_PART1.ts", "console.log(s);"), }); } if (modifyAgainFs) { @@ -146,7 +79,7 @@ namespace ts { // Verify baseline with build info + dts unChanged verifyOutFileScenario({ subScenario: "when final project is not composite but uses project references", - modifyFs: fs => replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, ""), + modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""), ignoreDtsChanged: true, baselineOnly: true }); @@ -154,7 +87,7 @@ namespace ts { // Verify baseline with build info verifyOutFileScenario({ subScenario: "when final project is not composite but incremental", - modifyFs: fs => replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, `"incremental": true,`), + modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, `"incremental": true,`), ignoreDtsChanged: true, ignoreDtsUnchanged: true, baselineOnly: true @@ -163,7 +96,7 @@ namespace ts { // Verify baseline with build info verifyOutFileScenario({ subScenario: "when final project specifies tsBuildInfoFile", - modifyFs: fs => replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, `"composite": true, + modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, `"composite": true, "tsBuildInfoFile": "./thirdjs/output/third.tsbuildinfo",`), ignoreDtsChanged: true, ignoreDtsUnchanged: true, @@ -192,7 +125,7 @@ namespace ts { subScenario: "verify buildInfo absence results in new build", fs: getOutFileFsAfterBuild, commandLineArgs: ["--b", "/src/third", "--verbose"], - modifyFs: fs => fs.unlinkSync(outputFiles[Project.first][Ext.buildinfo]), + modifyFs: fs => fs.unlinkSync("/src/first/bin/first-output.tsbuildinfo"), }); verifyTsc({ @@ -200,100 +133,69 @@ namespace ts { 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,`, ""), + modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""), }); - it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { - const { fs, tick } = getFsWithTime(outFileFs); - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host); - builder.build(); - host.assertDiagnosticMessages(...initialExpectedDiagnostics); - host.clearDiagnostics(); - tick(); - builder = createSolutionBuilder(host); - changeCompilerVersion(host); - tick(); - 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_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relSources[Project.first][Source.config], fakes.version, version], - [Diagnostics.Building_project_0, sources[Project.first][Source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relSources[Project.second][Source.config], fakes.version, version], - [Diagnostics.Building_project_0, sources[Project.second][Source.config]], - [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relSources[Project.third][Source.config], fakes.version, version], - [Diagnostics.Building_project_0, sources[Project.third][Source.config]], - ); + verifyTscCompileLike(tscCompileLike, { + scenario: "outFile", + subScenario: "rebuilds completely when version in tsbuildinfo doesnt match ts version", + fs: getOutFileFsAfterBuild, + commandLineArgs: ["--b", "/src/third", "--verbose"], + worker: sys => { + // Buildinfo will have version which does not match with current ts version + fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); + const buildHost = createSolutionBuilderHost(sys); + const builder = ts.createSolutionBuilder(buildHost, ["/src/third"], { verbose: true }); + sys.exit(builder.build()); + } }); - it("rebuilds completely when command line incremental flag changes between non dts changes", () => { - const { fs, tick } = getFsWithTime(outFileFs); + verifyTscSerializedIncrementalEdits({ + scenario: "outFile", + subScenario: "rebuilds completely when command line incremental flag changes between non dts changes", + fs: () => outFileFs, // Make non composite third project - replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, ""); - + modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""), // Build with command line incremental - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, { incremental: true }); - builder.build(); - host.assertDiagnosticMessages(...initialExpectedDiagnostics); - host.clearDiagnostics(); - tick(); - - // Make non incremental build with change in file that doesnt affect dts - appendText(fs, relSources[Project.first][Source.ts][Part.one], "console.log(s);"); - builder = createSolutionBuilder(host, { verbose: true }); - 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_oldest_output_1_is_older_than_newest_input_2, relSources[Project.first][Source.config], relOutputFiles[Project.first][Ext.js], relSources[Project.first][Source.ts][Part.one]], - [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.Building_project_0, sources[Project.third][Source.config]] - ); - host.clearDiagnostics(); - tick(); - - // Make incremental build with change in file that doesnt affect dts - appendText(fs, relSources[Project.first][Source.ts][Part.one], "console.log(s);"); - builder = createSolutionBuilder(host, { verbose: true, incremental: true }); - builder.build(); - // Builds completely because tsbuildinfo is old. - 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_oldest_output_1_is_older_than_newest_input_2, relSources[Project.first][Source.config], relOutputFiles[Project.first][Ext.js], relSources[Project.first][Source.ts][Part.one]], - [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_oldest_output_1_is_older_than_newest_input_2, relSources[Project.third][Source.config], relOutputFiles[Project.third][Ext.buildinfo], "src/first"], - [Diagnostics.Building_project_0, sources[Project.third][Source.config]] - ); - host.clearDiagnostics(); + commandLineArgs: ["--b", "/src/third", "--i", "--verbose"], + incrementalScenarios: [ + { + subScenario: "Make non incremental build with change in file that doesnt affect dts", + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => appendText(fs, "/src/first/first_PART1.ts", "console.log(s);"), + commandLineArgs: ["--b", "/src/third", "--verbose"], + }, + { + subScenario: "Make incremental build with change in file that doesnt affect dts", + buildKind: BuildKind.IncrementalDtsUnchanged, + modifyFs: fs => appendText(fs, "/src/first/first_PART1.ts", "console.log(s);"), + commandLineArgs: ["--b", "/src/third", "--verbose", "--incremental"], + } + ] }); - it("builds till project specified", () => { - const fs = outFileFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, { verbose: false }); - const result = builder.build(sources[Project.second][Source.config]); - host.assertDiagnosticMessages(/*empty*/); - // First and Third is not built - verifyOutputsAbsent(fs, [...outputFiles[Project.first], ...outputFiles[Project.third]]); - // second is built - verifyOutputsPresent(fs, outputFiles[Project.second]); - assert.equal(result, ExitStatus.Success); + verifyTscCompileLike(tscCompileLike, { + scenario: "outFile", + subScenario: "builds till project specified", + fs: () => outFileFs, + commandLineArgs: ["--build", "/src/second/tsconfig.json"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); + sys.exit(builder.build("/src/second/tsconfig.json")); + } }); - it("cleans till project specified", () => { - const fs = outFileFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, { verbose: false }); - builder.build(); - const result = builder.clean(sources[Project.second][Source.config]); - host.assertDiagnosticMessages(/*empty*/); - // First and Third output for present - verifyOutputsPresent(fs, [...outputFiles[Project.first], ...outputFiles[Project.third]]); - // second is cleaned - verifyOutputsAbsent(fs, outputFiles[Project.second]); - assert.equal(result, ExitStatus.Success); + verifyTscCompileLike(tscCompileLike, { + scenario: "outFile", + subScenario: "cleans till project specified", + fs: getOutFileFsAfterBuild, + commandLineArgs: ["--build", "--clean", "/src/second/tsconfig.json"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], { verbose: true }); + sys.exit(builder.clean("/src/second/tsconfig.json")); + } }); describe("Prepend output with .tsbuildinfo", () => { @@ -303,17 +205,17 @@ namespace ts { verifyOutFileScenario({ subScenario: "strict in all projects", modifyFs: fs => { - enableStrict(fs, sources[Project.first][Source.config]); - enableStrict(fs, sources[Project.second][Source.config]); - enableStrict(fs, sources[Project.third][Source.config]); + enableStrict(fs, "/src/first/tsconfig.json"); + enableStrict(fs, "/src/second/tsconfig.json"); + enableStrict(fs, "/src/third/tsconfig.json"); }, - modifyAgainFs: fs => addTestPrologue(fs, relSources[Project.first][Source.ts][Part.one], `"myPrologue"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue"`) }); // Verify ignore dtsChanged verifyOutFileScenario({ subScenario: "strict in one dependency", - modifyFs: fs => enableStrict(fs, sources[Project.second][Source.config]), + modifyFs: fs => enableStrict(fs, "/src/second/tsconfig.json"), modifyAgainFs: fs => addTestPrologue(fs, "src/first/first_PART1.ts", `"myPrologue"`), ignoreDtsChanged: true, baselineOnly: true @@ -323,28 +225,28 @@ namespace ts { verifyOutFileScenario({ subScenario: "multiple prologues in all projects", modifyFs: fs => { - enableStrict(fs, sources[Project.first][Source.config]); - addTestPrologue(fs, sources[Project.first][Source.ts][Part.one], `"myPrologue"`); - enableStrict(fs, sources[Project.second][Source.config]); - addTestPrologue(fs, sources[Project.second][Source.ts][Part.one], `"myPrologue"`); - addTestPrologue(fs, sources[Project.second][Source.ts][Part.two], `"myPrologue2";`); - enableStrict(fs, sources[Project.third][Source.config]); - addTestPrologue(fs, sources[Project.third][Source.ts][Part.one], `"myPrologue";`); - addTestPrologue(fs, sources[Project.third][Source.ts][Part.one], `"myPrologue3";`); + enableStrict(fs, "/src/first/tsconfig.json"); + addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue"`); + enableStrict(fs, "/src/second/tsconfig.json"); + addTestPrologue(fs, "/src/second/second_part1.ts", `"myPrologue"`); + addTestPrologue(fs, "/src/second/second_part2.ts", `"myPrologue2";`); + enableStrict(fs, "/src/third/tsconfig.json"); + addTestPrologue(fs, "/src/third/third_part1.ts", `"myPrologue";`); + addTestPrologue(fs, "/src/third/third_part1.ts", `"myPrologue3";`); }, - modifyAgainFs: fs => addTestPrologue(fs, relSources[Project.first][Source.ts][Part.one], `"myPrologue5"`) + modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue5"`) }); // Verify ignore dtsChanged verifyOutFileScenario({ subScenario: "multiple prologues in different projects", modifyFs: fs => { - enableStrict(fs, sources[Project.first][Source.config]); - addTestPrologue(fs, sources[Project.second][Source.ts][Part.one], `"myPrologue"`); - addTestPrologue(fs, sources[Project.second][Source.ts][Part.two], `"myPrologue2";`); - enableStrict(fs, sources[Project.third][Source.config]); + enableStrict(fs, "/src/first/tsconfig.json"); + addTestPrologue(fs, "/src/second/second_part1.ts", `"myPrologue"`); + addTestPrologue(fs, "/src/second/second_part2.ts", `"myPrologue2";`); + enableStrict(fs, "/src/third/tsconfig.json"); }, - modifyAgainFs: fs => addTestPrologue(fs, sources[Project.first][Source.ts][Part.one], `"myPrologue5"`), + modifyAgainFs: fs => addTestPrologue(fs, "/src/first/first_PART1.ts", `"myPrologue5"`), ignoreDtsChanged: true, baselineOnly: true }); @@ -456,13 +358,13 @@ namespace ts { } function diableRemoveCommentsInAll(fs: vfs.FileSystem) { - disableRemoveComments(fs, sources[Project.first][Source.config]); - disableRemoveComments(fs, sources[Project.second][Source.config]); - disableRemoveComments(fs, sources[Project.third][Source.config]); + disableRemoveComments(fs, "/src/first/tsconfig.json"); + disableRemoveComments(fs, "/src/second/tsconfig.json"); + disableRemoveComments(fs, "/src/third/tsconfig.json"); } function stripInternalOfThird(fs: vfs.FileSystem) { - replaceText(fs, sources[Project.third][Source.config], `"declaration": true,`, `"declaration": true, + replaceText(fs, "/src/third/tsconfig.json", `"declaration": true,`, `"declaration": true, "stripInternal": true,`); } @@ -472,8 +374,8 @@ namespace ts { diableRemoveCommentsInAll(fs); } stripInternalOfThird(fs); - replaceText(fs, sources[Project.first][Source.ts][Part.one], "interface", `${internal} interface`); - appendText(fs, sources[Project.second][Source.ts][Part.one], ` + replaceText(fs, "/src/first/first_PART1.ts", "interface", `${internal} interface`); + appendText(fs, "/src/second/second_part1.ts", ` class normalC { ${internal} constructor() { } ${internal} prop: string; @@ -505,14 +407,14 @@ ${internal} enum internalEnum { a, b, c }`); verifyOutFileScenario({ subScenario: "stripInternal", modifyFs: stripInternalScenario, - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/*@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), }); // Verify ignore dtsChanged verifyOutFileScenario({ subScenario: "stripInternal with comments emit enabled", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ true), - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/*@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), ignoreDtsChanged: true, baselineOnly: true }); @@ -521,7 +423,7 @@ ${internal} enum internalEnum { a, b, c }`); verifyOutFileScenario({ subScenario: "stripInternal jsdoc style comment", modifyFs: fs => stripInternalScenario(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/**@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/**@internal*/ interface`, "interface"), ignoreDtsChanged: true, baselineOnly: true }); @@ -536,9 +438,9 @@ ${internal} enum internalEnum { a, b, c }`); describe("with three levels of project dependency", () => { function makeOneTwoThreeDependOrder(fs: vfs.FileSystem) { - replaceText(fs, sources[Project.second][Source.config], "[", `[ + replaceText(fs, "/src/second/tsconfig.json", "[", `[ { "path": "../first", "prepend": true }`); - replaceText(fs, sources[Project.third][Source.config], `{ "path": "../first", "prepend": true },`, ""); + replaceText(fs, "/src/third/tsconfig.json", `{ "path": "../first", "prepend": true },`, ""); } function stripInternalWithDependentOrder(fs: vfs.FileSystem, removeCommentsDisabled?: boolean, jsDocStyle?: boolean) { @@ -550,14 +452,14 @@ ${internal} enum internalEnum { a, b, c }`); verifyOutFileScenario({ subScenario: "stripInternal when one-two-three are prepended in order", modifyFs: stripInternalWithDependentOrder, - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/*@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), }); // Verify ignore dtsChanged verifyOutFileScenario({ subScenario: "stripInternal with comments emit enabled when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ true), - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/*@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/*@internal*/ interface`, "interface"), ignoreDtsChanged: true, baselineOnly: true }); @@ -566,7 +468,7 @@ ${internal} enum internalEnum { a, b, c }`); verifyOutFileScenario({ subScenario: "stripInternal jsdoc style comment when one-two-three are prepended in order", modifyFs: fs => stripInternalWithDependentOrder(fs, /*removeCommentsDisabled*/ false, /*jsDocStyle*/ true), - modifyAgainFs: fs => replaceText(fs, sources[Project.first][Source.ts][Part.one], `/**@internal*/ interface`, "interface"), + modifyAgainFs: fs => replaceText(fs, "/src/first/first_PART1.ts", `/**@internal*/ interface`, "interface"), ignoreDtsChanged: true, baselineOnly: true }); @@ -585,7 +487,7 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "stripInternal baseline when internal is inside another internal", modifyFs: fs => { stripInternalOfThird(fs); - prependText(fs, sources[Project.first][Source.ts][Part.one], `namespace ts { + prependText(fs, "/src/first/first_PART1.ts", `namespace ts { /* @internal */ /** * Subset of properties from SourceFile that are used in multiple utility functions @@ -624,7 +526,7 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "stripInternal when few members of enum are internal", modifyFs: fs => { stripInternalOfThird(fs); - prependText(fs, sources[Project.first][Source.ts][Part.one], `enum TokenFlags { + prependText(fs, "/src/first/first_PART1.ts", `enum TokenFlags { None = 0, /* @internal */ PrecedingLineBreak = 1 << 0, @@ -659,9 +561,9 @@ ${internal} enum internalEnum { a, b, c }`); ignoreDtsChanged: true, ignoreDtsUnchanged: true, modifyFs: fs => { - fs.writeFileSync(sources[Project.first][Source.ts][Part.one], "/* @internal */ const A = 1;"); - fs.writeFileSync(sources[Project.third][Source.ts][Part.one], "const B = 2;"); - fs.writeFileSync(sources[Project.first][Source.config], JSON.stringify({ + fs.writeFileSync("/src/first/first_PART1.ts", "/* @internal */ const A = 1;"); + fs.writeFileSync("/src/third/third_part1.ts", "const B = 2;"); + fs.writeFileSync("/src/first/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, @@ -670,9 +572,9 @@ ${internal} enum internalEnum { a, b, c }`); sourceMap: true, outFile: "./bin/first-output.js" }, - files: [sources[Project.first][Source.ts][Part.one]] + files: ["/src/first/first_PART1.ts"] })); - fs.writeFileSync(sources[Project.third][Source.config], JSON.stringify({ + fs.writeFileSync("/src/third/tsconfig.json", JSON.stringify({ compilerOptions: { composite: true, declaration: true, @@ -682,7 +584,7 @@ ${internal} enum internalEnum { a, b, c }`); outFile: "./thirdjs/output/third-output.js", }, references: [{ path: "../first", prepend: true }], - files: [sources[Project.third][Source.ts][Part.one]] + files: ["/src/third/third_part1.ts"] })); } }); @@ -690,7 +592,7 @@ ${internal} enum internalEnum { a, b, c }`); describe("empty source files", () => { function makeThirdEmptySourceFile(fs: vfs.FileSystem) { - fs.writeFileSync(sources[Project.third][Source.ts][Part.one], "", "utf8"); + fs.writeFileSync("/src/third/third_part1.ts", "", "utf8"); } // Verify ignore dtsChanged @@ -706,9 +608,9 @@ ${internal} enum internalEnum { a, b, c }`); subScenario: "declarationMap and sourceMap disabled", modifyFs: fs => { makeThirdEmptySourceFile(fs); - replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, ""); - replaceText(fs, sources[Project.third][Source.config], `"sourceMap": true,`, ""); - replaceText(fs, sources[Project.third][Source.config], `"declarationMap": true,`, ""); + replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""); + replaceText(fs, "/src/third/tsconfig.json", `"sourceMap": true,`, ""); + replaceText(fs, "/src/third/tsconfig.json", `"declarationMap": true,`, ""); }, ignoreDtsChanged: true, ignoreDtsUnchanged: true, @@ -724,18 +626,18 @@ ${internal} enum internalEnum { a, b, c }`); 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" }`); + replaceText(fs, "/src/third/tsconfig.json", `{ "path": "../first", "prepend": true }`, `{ "path": "../first" }`); + replaceText(fs, "/src/third/tsconfig.json", `{ "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",`); + replaceText(fs, "/src/first/tsconfig.json", `"composite": true,`, `"composite": true, "module": "none",`); + replaceText(fs, "/src/second/tsconfig.json", `"composite": true,`, `"composite": true, "module": "none",`); + replaceText(fs, "/src/third/tsconfig.json", `"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",`, ""); + replaceText(fs, "/src/first/tsconfig.json", `"outFile": "./bin/first-output.js",`, ""); + replaceText(fs, "/src/second/tsconfig.json", `"outFile": "../2/second-output.js",`, ""); + replaceText(fs, "/src/third/tsconfig.json", `"outFile": "./thirdjs/output/third-output.js",`, ""); }, }); }); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index d666370d156f6..452f0c4082f7a 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -1,11 +1,6 @@ namespace ts { describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; - const testsOutputs = ["/src/tests/index.js", "/src/tests/index.d.ts", "/src/tests/tsconfig.tsbuildinfo"]; - const logicOutputs = ["/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts", "/src/logic/tsconfig.tsbuildinfo"]; - const coreOutputs = ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map", "/src/core/tsconfig.tsbuildinfo"]; - const allExpectedOutputs = [...testsOutputs, ...logicOutputs, ...coreOutputs]; - before(() => { projFs = loadProjectFromDisk("tests/projects/sample1"); }); @@ -14,6 +9,13 @@ namespace ts { projFs = undefined!; // Release the contents }); + function getTsBuildProjectFile(project: string, file: string): tscWatch.File { + return { + path: TestFSWithWatch.getTsBuildProjectFilePath(project, file), + content: projFs.readFileSync(`/src/${project}/${file}`, "utf8")! + }; + } + function getSampleFsAfterBuild() { const fs = projFs.shadow(); const host = fakes.SolutionBuilderHost.create(fs); @@ -73,27 +75,28 @@ namespace ts { incrementalScenarios: noChangeOnlyRuns }); - it("cleans till project specified", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.build(); - const result = builder.clean("/src/logic"); - host.assertDiagnosticMessages(/*empty*/); - verifyOutputsPresent(fs, testsOutputs); - verifyOutputsAbsent(fs, [...logicOutputs, ...coreOutputs]); - assert.equal(result, ExitStatus.Success); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "cleans till project specified", + fs: getSampleFsAfterBuild, + commandLineArgs: ["--b", "/src/logic", "--clean"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); + sys.exit(builder.clean("/src/logic")); + } }); - it("cleaning project in not build order doesnt throw error", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.build(); - const result = builder.clean("/src/logic2"); - host.assertDiagnosticMessages(/*empty*/); - verifyOutputsPresent(fs, allExpectedOutputs); - assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "cleaning project in not build order doesnt throw error", + fs: getSampleFsAfterBuild, + commandLineArgs: ["--b", "/src/logic2", "--clean"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); + sys.exit(builder.clean("/src/logic2")); + } }); }); @@ -108,17 +111,6 @@ namespace ts { }); describe("can detect when and what to rebuild", () => { - function initializeWithBuild(opts?: BuildOptions) { - const { fs, tick } = getFsWithTime(projFs); - const host = fakes.SolutionBuilderHost.create(fs); - let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.build(); - host.clearDiagnostics(); - tick(); - builder = createSolutionBuilder(host, ["/src/tests"], { ...(opts || {}), verbose: true }); - return { fs, host, builder }; - } - verifyTscIncrementalEdits({ scenario: "sample1", subScenario: "can detect when and what to rebuild", @@ -157,48 +149,39 @@ namespace ts { ] }); - it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { - const { host, builder } = initializeWithBuild(); - changeCompilerVersion(host); - 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_for_it_was_generated_with_version_1_that_differs_with_current_version_2, "src/core/tsconfig.json", fakes.version, version], - [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, "src/logic/tsconfig.json", fakes.version, version], - [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], - [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, "src/tests/tsconfig.json", fakes.version, version], - [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"], - ); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "rebuilds completely when version in tsbuildinfo doesnt match ts version", + fs: getSampleFsAfterBuild, + commandLineArgs: ["--b", "/src/tests", "--verbose"], + worker: sys => { + // Buildinfo will have version which does not match with current ts version + fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); + sys.exit(builder.build()); + } }); - it("does not rebuild if there is no program and bundle in the ts build info event if version doesnt match ts version", () => { - const { fs, tick } = getFsWithTime(projFs); - const host = fakes.SolutionBuilderHost.create(fs, /*options*/ undefined, /*setParentNodes*/ undefined, createAbstractBuilder); - 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"] - ); - verifyOutputsPresent(fs, allExpectedOutputs); - - host.clearDiagnostics(); - tick(); - builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - changeCompilerVersion(host); - 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"] - ); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "does not rebuild if there is no program and bundle in the ts build info event if version doesnt match ts version", + fs: () => { + const fs = projFs.shadow(); + const host = fakes.SolutionBuilderHost.create(fs, /*options*/ undefined, /*setParentNodes*/ undefined, createAbstractBuilder); + const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + builder.build(); + fs.makeReadonly(); + return fs; + }, + commandLineArgs: ["--b", "/src/tests", "--verbose"], + worker: sys => { + // Buildinfo will have version which does not match with current ts version + fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); + sys.exit(builder.build()); + }, }); verifyTscSerializedIncrementalEdits({ @@ -216,80 +199,87 @@ namespace ts { }] }); - it("builds till project specified", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - const result = builder.build("/src/logic"); - host.assertDiagnosticMessages(/*empty*/); - verifyOutputsAbsent(fs, testsOutputs); - verifyOutputsPresent(fs, [...logicOutputs, ...coreOutputs]); - assert.equal(result, ExitStatus.Success); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "builds till project specified", + fs: () => projFs, + commandLineArgs: ["--build", "/src/logic/tsconfig.json"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/tests"], {}); + sys.exit(builder.build("/src/logic/tsconfig.json")); + } }); - it("building project in not build order doesnt throw error", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - const result = builder.build("/src/logic2"); - host.assertDiagnosticMessages(/*empty*/); - verifyOutputsAbsent(fs, allExpectedOutputs); - assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "building project in not build order doesnt throw error", + fs: () => projFs, + commandLineArgs: ["--build", "/src/logic2/tsconfig.json"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/tests"], {}); + sys.exit(builder.build("/src/logic2/tsconfig.json")); + } }); it("building using getNextInvalidatedProject", () => { - interface SolutionBuilderResult { - project: ResolvedConfigFileName; - result: T; - } + const coreConfig = getTsBuildProjectFile("core", "tsconfig.json"); + const coreIndex = getTsBuildProjectFile("core", "index.ts"); + const coreDecl = getTsBuildProjectFile("core", "some_decl.d.ts"); + const coreAnotherModule = getTsBuildProjectFile("core", "anotherModule.ts"); + const logicConfig = getTsBuildProjectFile("logic", "tsconfig.json"); + const logicIndex = getTsBuildProjectFile("logic", "index.ts"); + const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); + const testsIndex = getTsBuildProjectFile("tests", "index.ts"); + const baseline: string[] = []; + let oldSnap: ReturnType | undefined; + const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( + fakes.patchHostForBuildInfoReadWrite( + tscWatch.createWatchedSystem([ + coreConfig, coreIndex, coreDecl, coreAnotherModule, + logicConfig, logicIndex, + testsConfig, testsIndex, + tscWatch.libFile + ]) + ) + ); - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], {}); - verifyBuildNextResult({ - project: "/src/core/tsconfig.json" as ResolvedConfigFileName, - result: ExitStatus.Success - }, coreOutputs, [...logicOutputs, ...testsOutputs]); - - verifyBuildNextResult({ - project: "/src/logic/tsconfig.json" as ResolvedConfigFileName, - result: ExitStatus.Success - }, [...coreOutputs, ...logicOutputs], testsOutputs); - - verifyBuildNextResult({ - project: "/src/tests/tsconfig.json" as ResolvedConfigFileName, - result: ExitStatus.Success - }, allExpectedOutputs, emptyArray); - - verifyBuildNextResult(/*expected*/ undefined, allExpectedOutputs, emptyArray); - - function verifyBuildNextResult( - expected: SolutionBuilderResult | undefined, - presentOutputs: readonly string[], - absentOutputs: readonly string[] - ) { + const host = createSolutionBuilderHost(system); + const builder = createSolutionBuilder(host, [testsConfig.path], {}); + baseline.push("Input::"); + baselineState(); + verifyBuildNextResult(); // core + verifyBuildNextResult(); // logic + verifyBuildNextResult();// tests + verifyBuildNextResult(); // All Done + Harness.Baseline.runBaseline(`tsbuild/sample1/building-using-getNextInvalidatedProject.js`, baseline.join("\r\n")); + + function verifyBuildNextResult() { const project = builder.getNextInvalidatedProject(); const result = project && project.done(); - assert.deepEqual(project && { project: project.project, result }, expected); - verifyOutputsPresent(fs, presentOutputs); - verifyOutputsAbsent(fs, absentOutputs); + baseline.push(`Project Result:: ${JSON.stringify({ project: project?.project, result })}`); + baselineState(); + } + + function baselineState() { + system.serializeOutput(baseline); + system.diff(baseline, oldSnap); + system.writtenFiles.clear(); + oldSnap = system.snap(); } }); - it("building using buildReferencedProject", () => { - const fs = projFs.shadow(); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.buildReferences("/src/tests"); - host.assertDiagnosticMessages( - getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/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"], - ); - verifyOutputsPresent(fs, [...coreOutputs, ...logicOutputs]); - verifyOutputsAbsent(fs, testsOutputs); + verifyTscCompileLike(tscCompileLike, { + scenario: "sample1", + subScenario: "building using buildReferencedProject", + fs: () => projFs, + commandLineArgs: ["--build", "/src/logic2/tsconfig.json"], + worker: sys => { + const buildHost = createSolutionBuilderHost(sys); + const builder = createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); + sys.exit(builder.buildReferences("/src/tests")); + } }); }); @@ -305,55 +295,62 @@ namespace ts { describe("project invalidation", () => { it("invalidates projects correctly", () => { - const { fs, time, tick } = getFsWithTime(projFs); - const host = fakes.SolutionBuilderHost.create(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); + const coreConfig = getTsBuildProjectFile("core", "tsconfig.json"); + const coreIndex = getTsBuildProjectFile("core", "index.ts"); + const coreDecl = getTsBuildProjectFile("core", "some_decl.d.ts"); + const coreAnotherModule = getTsBuildProjectFile("core", "anotherModule.ts"); + const logicConfig = getTsBuildProjectFile("logic", "tsconfig.json"); + const logicIndex = getTsBuildProjectFile("logic", "index.ts"); + const testsConfig = getTsBuildProjectFile("tests", "tsconfig.json"); + const testsIndex = getTsBuildProjectFile("tests", "index.ts"); + const baseline: string[] = []; + let oldSnap: ReturnType | undefined; + const system = TestFSWithWatch.changeToHostTrackingWrittenFiles( + fakes.patchHostForBuildInfoReadWrite( + tscWatch.createWatchedSystem([ + coreConfig, coreIndex, coreDecl, coreAnotherModule, + logicConfig, logicIndex, + testsConfig, testsIndex, + tscWatch.libFile + ]) + ) + ); + const host = createSolutionBuilderHost(system); + const builder = createSolutionBuilder(host, [testsConfig.path], { dry: false, force: false, verbose: false }); builder.build(); - host.assertDiagnosticMessages(/*empty*/); + baselineState("Build of project"); // Update a timestamp in the middle project - tick(); - appendText(fs, "/src/logic/index.ts", "function foo() {}"); - const originalWriteFile = fs.writeFileSync; - const writtenFiles = new Map(); - fs.writeFileSync = (path, data, encoding) => { - writtenFiles.set(path, true); - originalWriteFile.call(fs, path, data, encoding); - }; + system.appendFile(logicIndex.path, "function foo() {}"); + // Because we haven't reset the build context, the builder should assume there's nothing to do right now - const status = builder.getUpToDateStatusOfProject("/src/logic"); - assert.equal(status.type, UpToDateStatusType.UpToDate, "Project should be assumed to be up-to-date"); - verifyInvalidation(/*expectedToWriteTests*/ false); + const status = builder.getUpToDateStatusOfProject(logicConfig.path); + baseline.push(`Project should still be upto date: ${UpToDateStatusType[status.type]}`); + verifyInvalidation("non Dts change to logic"); // Rebuild this project - fs.writeFileSync("/src/logic/index.ts", `${fs.readFileSync("/src/logic/index.ts")} -export class cNew {}`); - verifyInvalidation(/*expectedToWriteTests*/ true); + system.appendFile(logicIndex.path, `export class cNew {}`); + verifyInvalidation("Dts change to Logic"); + Harness.Baseline.runBaseline(`tsbuild/sample1/invalidates-projects-correctly.js`, baseline.join("\r\n")); - function verifyInvalidation(expectedToWriteTests: boolean) { + function verifyInvalidation(heading: string) { // Rebuild this project - tick(); - builder.invalidateProject("/src/logic/tsconfig.json" as ResolvedConfigFilePath); + builder.invalidateProject(logicConfig.path as ResolvedConfigFilePath); builder.buildNextInvalidatedProject(); - // The file should be updated - assert.isTrue(writtenFiles.has("/src/logic/index.js"), "JS file should have been rebuilt"); - assert.equal(fs.statSync("/src/logic/index.js").mtimeMs, time(), "JS file should have been rebuilt"); - assert.isFalse(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should *not* have been rebuilt"); - assert.isBelow(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should *not* have been rebuilt"); - writtenFiles.clear(); + baselineState(`${heading}:: After rebuilding logicConfig`); // Build downstream projects should update 'tests', but not 'core' - tick(); builder.buildNextInvalidatedProject(); - if (expectedToWriteTests) { - assert.isTrue(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should have been rebuilt"); - } - else { - assert.equal(writtenFiles.size, 0, "Should not write any new files"); - } - assert.equal(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should have new timestamp"); - assert.isBelow(fs.statSync("/src/core/index.js").mtimeMs, time(), "Upstream JS file should not have been rebuilt"); + baselineState(`${heading}:: After building next project`); + } + + function baselineState(heading: string) { + baseline.push(heading); + system.serializeOutput(baseline); + system.diff(baseline, oldSnap); + system.writtenFiles.clear(); + oldSnap = system.snap(); } }); }); diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index 5d63b9b47e157..e6ba2f0e93e52 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,21 +1,6 @@ namespace ts.tscWatch { import projectsLocation = TestFSWithWatch.tsbuildProjectsLocation; describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { - type TsBuildWatchSystem = TestFSWithWatch.TestServerHostTrackingWrittenFiles; - - function createTsBuildWatchSystem(fileOrFolderList: readonly TestFSWithWatch.FileOrFolderOrSymLink[], params?: TestFSWithWatch.TestServerHostCreationParameters) { - return TestFSWithWatch.changeToHostTrackingWrittenFiles( - createWatchedSystem(fileOrFolderList, params) - ); - } - - type OutputFileStamp = [string, Date | undefined, boolean]; - function transformOutputToOutputFileStamp(f: string, host: TsBuildWatchSystem): OutputFileStamp { - return [f, host.getModifiedTime(f), host.writtenFiles.has(host.toFullPath(f))] as OutputFileStamp; - } - - const scenario = "programUpdates"; - const project = "sample1"; const enum SubProject { core = "core", logic = "logic", @@ -24,17 +9,13 @@ namespace ts.tscWatch { } type ReadonlyFile = Readonly; /** [tsconfig, index] | [tsconfig, index, anotherModule, someDecl] */ - type SubProjectFiles = [ReadonlyFile, ReadonlyFile] | [ReadonlyFile, ReadonlyFile, ReadonlyFile, ReadonlyFile]; - function projectPath(subProject: SubProject) { - return TestFSWithWatch.getTsBuildProjectFilePath(project, subProject); - } - + type SubProjectFiles = [tsconfig: ReadonlyFile, index: ReadonlyFile] | [tsconfig: ReadonlyFile, index: ReadonlyFile, anotherModule: ReadonlyFile, someDecl: ReadonlyFile]; function projectFilePath(subProject: SubProject, baseFileName: string) { - return `${projectPath(subProject)}/${baseFileName.toLowerCase()}`; + return `${TestFSWithWatch.getTsBuildProjectFilePath("sample1", subProject)}/${baseFileName.toLowerCase()}`; } function projectFile(subProject: SubProject, baseFileName: string): File { - return TestFSWithWatch.getTsBuildProjectFile(project, `${subProject}/${baseFileName}`); + return TestFSWithWatch.getTsBuildProjectFile("sample1", `${subProject}/${baseFileName}`); } function subProjectFiles(subProject: SubProject, anotherModuleAndSomeDecl?: true): SubProjectFiles { @@ -48,29 +29,6 @@ namespace ts.tscWatch { return [tsconfig, index, anotherModule, someDecl]; } - function getOutputFileNames(subProject: SubProject, baseFileNameWithoutExtension: string) { - const file = projectFilePath(subProject, baseFileNameWithoutExtension); - return [`${file}.js`, `${file}.d.ts`]; - } - - function getOutputStamps(host: TsBuildWatchSystem, subProject: SubProject, baseFileNameWithoutExtension: string): OutputFileStamp[] { - return getOutputFileNames(subProject, baseFileNameWithoutExtension).map(f => transformOutputToOutputFileStamp(f, host)); - } - - function getOutputFileStamps(host: TsBuildWatchSystem, additionalFiles?: readonly [SubProject, string][]): OutputFileStamp[] { - const result = [ - ...getOutputStamps(host, SubProject.core, "anotherModule"), - ...getOutputStamps(host, SubProject.core, "index"), - ...getOutputStamps(host, SubProject.logic, "index"), - ...getOutputStamps(host, SubProject.tests, "index"), - ]; - if (additionalFiles) { - additionalFiles.forEach(([subProject, baseFileNameWithoutExtension]) => result.push(...getOutputStamps(host, subProject, baseFileNameWithoutExtension))); - } - host.writtenFiles.clear(); - return result; - } - function changeFile(fileName: string | (() => string), content: string | (() => string), caption: string): TscWatchCompileChange { return { caption, @@ -88,8 +46,6 @@ namespace ts.tscWatch { let tests: SubProjectFiles; let ui: SubProjectFiles; let allFiles: readonly File[]; - let testProjectExpectedWatchedFiles: string[]; - let testProjectExpectedWatchedDirectoriesRecursive: string[]; before(() => { core = subProjectFiles(SubProject.core, /*anotherModuleAndSomeDecl*/ true); @@ -97,8 +53,6 @@ namespace ts.tscWatch { tests = subProjectFiles(SubProject.tests); ui = subProjectFiles(SubProject.ui); allFiles = [libFile, ...core, ...logic, ...tests, ...ui]; - testProjectExpectedWatchedFiles = [core[0], core[1], core[2]!, ...logic, ...tests].map(f => f.path.toLowerCase()); - testProjectExpectedWatchedDirectoriesRecursive = [projectPath(SubProject.core), projectPath(SubProject.logic)]; }); after(() => { @@ -107,38 +61,32 @@ namespace ts.tscWatch { tests = undefined!; ui = undefined!; allFiles = undefined!; - testProjectExpectedWatchedFiles = undefined!; - testProjectExpectedWatchedDirectoriesRecursive = undefined!; }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "creates solution in watch mode", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`], sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), changes: emptyArray }); it("verify building references watches only those projects", () => { - const system = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); - const host = createSolutionBuilderWithWatchHost(system); - const solutionBuilder = createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`], { watch: true }); - solutionBuilder.buildReferences(`${project}/${SubProject.tests}`); - - checkWatchedFiles(system, testProjectExpectedWatchedFiles.slice(0, testProjectExpectedWatchedFiles.length - tests.length)); - checkWatchedDirectories(system, emptyArray, /*recursive*/ false); - checkWatchedDirectories(system, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true); - - checkOutputErrorsInitial(system, emptyArray); - const testOutput = getOutputStamps(system, SubProject.tests, "index"); - const outputFileStamps = getOutputFileStamps(system); - for (const stamp of outputFileStamps.slice(0, outputFileStamps.length - testOutput.length)) { - assert.isDefined(stamp[1], `${stamp[0]} expected to be present`); - } - for (const stamp of testOutput) { - assert.isUndefined(stamp[1], `${stamp[0]} expected to be missing`); - } - return system; + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem(allFiles, { currentDirectory: projectsLocation })); + const host = createSolutionBuilderWithWatchHostForBaseline(sys, cb); + const solutionBuilder = createSolutionBuilderWithWatch(host, [`sample1/${SubProject.tests}`], { watch: true }); + solutionBuilder.buildReferences(`sample1/${SubProject.tests}`); + runWatchBaseline({ + scenario: "programUpdates", + subScenario: "verify building references watches only those projects", + commandLineArgs: ["--b", "--w"], + sys, + baseline, + oldSnap, + getPrograms, + changes: emptyArray, + watchOrSolution: solutionBuilder + }); }); const buildTests: TscWatchCompileChange = { @@ -163,9 +111,9 @@ namespace ts.tscWatch { }; verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: `${subScenario}/change builds changes and reports found errors message`, - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`], sys: () => createWatchedSystem( allFilesGetter(), { currentDirectory: projectsLocation } @@ -198,9 +146,9 @@ export class someClass2 { }`); }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: `${subScenario}/non local change does not start build of referencing projects`, - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`], sys: () => createWatchedSystem( allFilesGetter(), { currentDirectory: projectsLocation } @@ -217,9 +165,9 @@ function foo() { }`, "Make local change to core"), return changeFile(newFile.path, newFileContent, "Change to new File and build core"); } verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: `${subScenario}/builds when new file is added, and its subsequent updates`, - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`], sys: () => createWatchedSystem( allFilesGetter(), { currentDirectory: projectsLocation } @@ -262,9 +210,9 @@ export class someClass2 { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "watches config files that are not present", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`], sys: () => createWatchedSystem( [libFile, ...core, logic[1], ...tests], { currentDirectory: projectsLocation } @@ -297,9 +245,9 @@ export class someClass2 { }`), timeouts: checkSingleTimeoutQueueLengthAndRunAndVerifyNoTimeout, }; verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "when referenced using prepend builds referencing project even for non local change", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.logic}`], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.logic}`], sys: () => { const coreTsConfig: File = { path: core[0].path, @@ -332,7 +280,7 @@ function myFunc() { return 100; }`, "Make local change and build core"), }); describe("when referenced project change introduces error in the down stream project and then fixes it", () => { - const subProjectLibrary = `${projectsLocation}/${project}/Library`; + const subProjectLibrary = `${projectsLocation}/sample1/Library`; const libraryTs: File = { path: `${subProjectLibrary}/library.ts`, content: ` @@ -349,7 +297,7 @@ export function createSomeObject(): SomeObject }` }; verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "when referenced project change introduces error in the down stream project and then fixes it", commandLineArgs: ["-b", "-w", "App"], sys: () => { @@ -357,7 +305,7 @@ export function createSomeObject(): SomeObject path: `${subProjectLibrary}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true } }) }; - const subProjectApp = `${projectsLocation}/${project}/App`; + const subProjectApp = `${projectsLocation}/sample1/App`; const appTs: File = { path: `${subProjectApp}/app.ts`, content: `import { createSomeObject } from "../Library/library"; @@ -369,7 +317,7 @@ createSomeObject().message;` }; const files = [libFile, libraryTs, libraryTsconfig, appTs, appTsconfig]; - return createWatchedSystem(files, { currentDirectory: `${projectsLocation}/${project}` }); + return createWatchedSystem(files, { currentDirectory: `${projectsLocation}/sample1` }); }, changes: [ { @@ -398,9 +346,9 @@ createSomeObject().message;` describe("reports errors in all projects on incremental compile", () => { function verifyIncrementalErrors(subScenario: string, buildOptions: readonly string[]) { verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: `reportErrors/${subScenario}`, - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`, ...buildOptions], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`, ...buildOptions], sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), changes: [ { @@ -466,7 +414,7 @@ let x: string = 10;`), }; verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "reportErrors/declarationEmitErrors/when fixing error files all files are emitted", commandLineArgs: ["-b", "-w", subProject], sys: () => createWatchedSystem( @@ -479,7 +427,7 @@ let x: string = 10;`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "reportErrors/declarationEmitErrors/when file with no error changes", commandLineArgs: ["-b", "-w", subProject], sys: () => createWatchedSystem( @@ -499,7 +447,7 @@ let x: string = 10;`), }; verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "reportErrors/declarationEmitErrors/introduceError/when fixing errors only changed file is emitted", commandLineArgs: ["-b", "-w", subProject], sys: () => createWatchedSystem( @@ -513,7 +461,7 @@ let x: string = 10;`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "reportErrors/declarationEmitErrors/introduceError/when file with no error changes", commandLineArgs: ["-b", "-w", subProject], sys: () => createWatchedSystem( @@ -530,9 +478,9 @@ let x: string = 10;`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "incremental updates in verbose mode", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`, "-verbose"], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.tests}`, "-verbose"], sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), changes: [ { @@ -557,7 +505,7 @@ export function someFn() { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "works when noUnusedParameters changes to false", commandLineArgs: ["-b", "-w"], sys: () => { @@ -589,15 +537,15 @@ export function someFn() { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "should not trigger recompilation because of program emit", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.core}`, "-verbose"], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.core}`, "-verbose"], sys: () => createWatchedSystem([libFile, ...core], { currentDirectory: projectsLocation }), changes: [ noopChange, { caption: "Add new file", - change: sys => sys.writeFile(`${project}/${SubProject.core}/file3.ts`, `export const y = 10;`), + change: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`), timeouts: checkSingleTimeoutQueueLengthAndRun }, noopChange, @@ -605,9 +553,9 @@ export function someFn() { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "should not trigger recompilation because of program emit with outDir specified", - commandLineArgs: ["-b", "-w", `${project}/${SubProject.core}`, "-verbose"], + commandLineArgs: ["-b", "-w", `sample1/${SubProject.core}`, "-verbose"], sys: () => { const [coreConfig, ...rest] = core; const newCoreConfig: File = { path: coreConfig.path, content: JSON.stringify({ compilerOptions: { composite: true, outDir: "outDir" } }) }; @@ -617,7 +565,7 @@ export function someFn() { }`), noopChange, { caption: "Add new file", - change: sys => sys.writeFile(`${project}/${SubProject.core}/file3.ts`, `export const y = 10;`), + change: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`), timeouts: checkSingleTimeoutQueueLengthAndRun }, noopChange @@ -625,7 +573,7 @@ export function someFn() { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "works with extended source files", commandLineArgs: ["-b", "-w", "-v", "project1.tsconfig.json", "project2.tsconfig.json"], sys: () => { @@ -711,7 +659,7 @@ export function someFn() { }`), }); verifyTscWatch({ - scenario, + scenario: "programUpdates", subScenario: "works correctly when project with extended config is removed", commandLineArgs: ["-b", "-w", "-v"], sys: () => { diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index bca1472e0d893..21ccf2948c5b6 100644 --- a/src/testRunner/unittests/tsbuildWatch/publicApi.ts +++ b/src/testRunner/unittests/tsbuildWatch/publicApi.ts @@ -40,17 +40,8 @@ export enum e2 { } export function f22() { } // trailing` }; const commandLineArgs = ["--b", "--w"]; - const { sys, baseline, oldSnap } = createBaseline(createWatchedSystem([libFile, solution, sharedConfig, sharedIndex, webpackConfig, webpackIndex], { currentDirectory: projectRoot })); - const { cb, getPrograms } = commandLineCallbacks(sys); - const buildHost = createSolutionBuilderWithWatchHost( - sys, - /*createProgram*/ undefined, - createDiagnosticReporter(sys, /*pretty*/ true), - createBuilderStatusReporter(sys, /*pretty*/ true), - createWatchStatusReporter(sys, /*pretty*/ true) - ); - buildHost.afterProgramEmitAndDiagnostics = cb; - buildHost.afterEmitBundle = cb; + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([libFile, solution, sharedConfig, sharedIndex, webpackConfig, webpackIndex], { currentDirectory: projectRoot })); + const buildHost = createSolutionBuilderWithWatchHostForBaseline(sys, cb); buildHost.getCustomTransformers = getCustomTransformers; const builder = createSolutionBuilderWithWatch(buildHost, [solution.path], { verbose: true }); builder.build(); diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 599b5790f85b9..a01b35f5a98cc 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -23,52 +23,56 @@ namespace ts.tscWatch { const allPkgFiles = pkgs(pkgFiles); const system = createWatchedSystem([libFile, typing, ...flatArray(allPkgFiles)], { currentDirectory: project, environmentVariables }); - writePkgReferences(); - const host = createSolutionBuilderWithWatchHost(system); + writePkgReferences(system); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(system); + const host = createSolutionBuilderWithWatchHostForBaseline(sys, cb); const solutionBuilder = createSolutionBuilderWithWatch(host, ["tsconfig.json"], { watch: true, verbose: true }); solutionBuilder.build(); - checkOutputErrorsInitial(system, emptyArray, /*disableConsoleClears*/ undefined, [ - `Projects in this build: \r\n${ - concatenate( - pkgs(index => ` * pkg${index}/tsconfig.json`), - [" * tsconfig.json"] - ).join("\r\n")}\n\n`, - ...flatArray(pkgs(index => [ - `Project 'pkg${index}/tsconfig.json' is out of date because output file 'pkg${index}/index.js' does not exist\n\n`, - `Building project '${project}/pkg${index}/tsconfig.json'...\n\n` - ])) - ]); - - const watchFilesDetailed = arrayToMap(flatArray(allPkgFiles), f => f.path, () => 1); - watchFilesDetailed.set(configPath, 1); - watchFilesDetailed.set(typing.path, singleWatchPerFile ? 1 : maxPkgs); - checkWatchedFilesDetailed(system, watchFilesDetailed); - system.writeFile(typing.path, `${typing.content}export const typing1 = 10;`); - verifyInvoke(); - - // Make change - maxPkgs--; - writePkgReferences(); - system.checkTimeoutQueueLengthAndRun(1); - checkOutputErrorsIncremental(system, emptyArray); - const lastFiles = last(allPkgFiles); - lastFiles.forEach(f => watchFilesDetailed.delete(f.path)); - watchFilesDetailed.set(typing.path, singleWatchPerFile ? 1 : maxPkgs); - checkWatchedFilesDetailed(system, watchFilesDetailed); - system.writeFile(typing.path, typing.content); - verifyInvoke(); - - // Make change to remove all the watches - maxPkgs = 0; - writePkgReferences(); - system.checkTimeoutQueueLengthAndRun(1); - checkOutputErrorsIncremental(system, [ - `tsconfig.json(1,10): error TS18002: The 'files' list in config file '${configPath}' is empty.\n` - ]); - checkWatchedFilesDetailed(system, [configPath], 1); - - system.writeFile(typing.path, `${typing.content}export const typing1 = 10;`); - system.checkTimeoutQueueLength(0); + runWatchBaseline({ + scenario: "watchEnvironment", + subScenario: `same file in multiple projects${singleWatchPerFile ? " with single watcher per file" : ""}`, + commandLineArgs: ["--b", "--w"], + sys, + baseline, + oldSnap, + getPrograms, + changes: [ + { + caption: "modify typing file", + change: sys => sys.writeFile(typing.path, `${typing.content}export const typing1 = 10;`), + timeouts: sys => pkgs(() => sys.checkTimeoutQueueLengthAndRun(1)) + }, + { + // Make change + caption: "change pkg references", + change: sys => { + maxPkgs--; + writePkgReferences(sys); + }, + timeouts: checkSingleTimeoutQueueLengthAndRun, + }, + { + caption: "modify typing file", + change: sys => sys.writeFile(typing.path, typing.content), + timeouts: sys => pkgs(() => sys.checkTimeoutQueueLengthAndRun(1)) + }, + { + // Make change to remove all watches + caption: "change pkg references to remove all watches", + change: sys => { + maxPkgs = 0; + writePkgReferences(sys); + }, + timeouts: checkSingleTimeoutQueueLengthAndRun, + }, + { + caption: "modify typing file", + change: sys => sys.writeFile(typing.path, `${typing.content}export const typing1 = 10;`), + timeouts: sys => pkgs(() => sys.checkTimeoutQueueLengthAndRun(1)) + }, + ], + watchOrSolution: solutionBuilder + }); function flatArray(arr: T[][]): readonly T[] { return flatMap(arr, identity); @@ -101,23 +105,13 @@ namespace ts.tscWatch { } ]; } - function writePkgReferences() { + function writePkgReferences(system: TestFSWithWatch.TestServerHost) { system.writeFile(configPath, JSON.stringify({ files: [], include: [], references: pkgs(createPkgReference) })); } - function verifyInvoke() { - pkgs(() => system.checkTimeoutQueueLengthAndRun(1)); - checkOutputErrorsIncremental(system, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [ - ...flatArray(pkgs(index => [ - `Project 'pkg${index}/tsconfig.json' is out of date because oldest output 'pkg${index}/index.js' is older than newest input 'typings/xterm.d.ts'\n\n`, - `Building project '${project}/pkg${index}/tsconfig.json'...\n\n`, - `Updating unchanged output timestamps of project '${project}/pkg${index}/tsconfig.json'...\n\n` - ])) - ]); - } }); } }); diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 14c4bc0df5127..de4930ebe115e 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -19,30 +19,21 @@ namespace ts { }; export const noChangeOnlyRuns = [noChangeRun]; - export interface TscCompile { - scenario: string; - subScenario: string; - buildKind?: BuildKind; // Should be defined for tsc --b - fs: () => vfs.FileSystem; - commandLineArgs: readonly string[]; - - modifyFs?: (fs: vfs.FileSystem) => void; + export interface TscCompile extends TscCompileLikeBase { baselineSourceMap?: boolean; baselineReadFileCalls?: boolean; baselinePrograms?: boolean; baselineDependencies?: boolean; - disableUseFileVersionAsSignature?: boolean; - environmentVariables?: Record; } - export type CommandLineProgram = [Program, EmitAndSemanticDiagnosticsBuilderProgram?]; + export type CommandLineProgram = [Program, BuilderProgram?]; export interface CommandLineCallbacks { cb: ExecuteCommandLineCallbacks; getPrograms: () => readonly CommandLineProgram[]; } - function isAnyProgram(program: Program | EmitAndSemanticDiagnosticsBuilderProgram | ParsedCommandLine): program is Program | EmitAndSemanticDiagnosticsBuilderProgram { - return !!(program as Program | EmitAndSemanticDiagnosticsBuilderProgram).getCompilerOptions; + function isAnyProgram(program: Program | BuilderProgram | ParsedCommandLine): program is Program | BuilderProgram { + return !!(program as Program | BuilderProgram).getCompilerOptions; } export function commandLineCallbacks( sys: System & { writtenFiles: ReadonlyCollection; }, @@ -71,15 +62,26 @@ namespace ts { } }; } + export interface TscCompileLikeBase extends VerifyTscCompileLike { + buildKind?: BuildKind; // Should be defined for tsc --b - export function tscCompile(input: TscCompile) { + modifyFs?: (fs: vfs.FileSystem) => void; + disableUseFileVersionAsSignature?: boolean; + environmentVariables?: Record; + } + + export interface TscCompileLike extends TscCompileLikeBase { + worker: (sys: TscCompileSystem) => void; + additionalBaseline?: (sys: TscCompileSystem) => void; + } + export function tscCompileLike(input: TscCompileLike) { const initialFs = input.fs(); const inputFs = initialFs.shadow(); const { scenario, subScenario, buildKind, commandLineArgs, modifyFs, - baselineSourceMap, baselineReadFileCalls, baselinePrograms, baselineDependencies, - environmentVariables + environmentVariables, + worker, additionalBaseline, } = input; if (modifyFs) modifyFs(inputFs); inputFs.makeReadonly(); @@ -88,46 +90,12 @@ namespace ts { // Create system const sys = new fakes.System(fs, { executingFilePath: "/lib/tsc", env: environmentVariables }) as TscCompileSystem; if (input.disableUseFileVersionAsSignature) sys.disableUseFileVersionAsSignature = true; - fakes.patchHostForBuildInfoReadWrite(sys); - const writtenFiles = sys.writtenFiles = new Set(); - const originalWriteFile = sys.writeFile; - sys.writeFile = (fileName, content, writeByteOrderMark) => { - const path = toPathWithSystem(sys, fileName); - assert.isFalse(writtenFiles.has(path)); - writtenFiles.add(path); - return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); - }; - const actualReadFileMap: MapLike = {}; - const originalReadFile = sys.readFile; - sys.readFile = path => { - // Dont record libs - if (path.startsWith("/src/")) { - actualReadFileMap[path] = (getProperty(actualReadFileMap, path) || 0) + 1; - } - return originalReadFile.call(sys, path); - }; - sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`); sys.exit = exitCode => sys.exitCode = exitCode; - const { cb, getPrograms } = commandLineCallbacks(sys, originalReadFile, originalWriteFile); - executeCommandLine( - sys, - cb, - commandLineArgs, - ); + worker(sys); sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`); - if (baselinePrograms) { - const baseline: string[] = []; - tscWatch.baselinePrograms(baseline, getPrograms, emptyArray, baselineDependencies); - sys.write(baseline.join("\n")); - } - if (baselineReadFileCalls) { - sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); - } - if (baselineSourceMap) generateSourceMapBaselineFiles(sys); - + additionalBaseline?.(sys); fs.makeReadonly(); - sys.baseLine = () => { const baseFsPatch = !buildKind || buildKind === BuildKind.Initial ? inputFs.diff(/*base*/ undefined, { baseIsNotShadowRoot: true }) : @@ -147,30 +115,87 @@ ${patch ? vfs.formatPatch(patch) : ""}` return sys; } + export function tscCompile(input: TscCompile) { + let actualReadFileMap: MapLike | undefined; + let getPrograms: CommandLineCallbacks["getPrograms"] | undefined; + return tscCompileLike({ + ...input, + worker, + additionalBaseline + }); + + function worker(sys: TscCompileSystem) { + fakes.patchHostForBuildInfoReadWrite(sys); + const writtenFiles = sys.writtenFiles = new Set(); + const originalWriteFile = sys.writeFile; + sys.writeFile = (fileName, content, writeByteOrderMark) => { + const path = toPathWithSystem(sys, fileName); + assert.isFalse(writtenFiles.has(path)); + writtenFiles.add(path); + return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); + }; + actualReadFileMap = {}; + const originalReadFile = sys.readFile; + sys.readFile = path => { + // Dont record libs + if (path.startsWith("/src/")) { + actualReadFileMap![path] = (getProperty(actualReadFileMap!, path) || 0) + 1; + } + return originalReadFile.call(sys, path); + }; + + const result = commandLineCallbacks(sys, originalReadFile, originalWriteFile); + executeCommandLine( + sys, + result.cb, + input.commandLineArgs, + ); + sys.readFile = originalReadFile; + getPrograms = result.getPrograms; + } + + function additionalBaseline(sys: TscCompileSystem) { + const { baselineSourceMap, baselineReadFileCalls, baselinePrograms, baselineDependencies } = input; + if (baselinePrograms) { + const baseline: string[] = []; + tscWatch.baselinePrograms(baseline, getPrograms!, emptyArray, baselineDependencies); + sys.write(baseline.join("\n")); + } + if (baselineReadFileCalls) { + sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); + } + if (baselineSourceMap) generateSourceMapBaselineFiles(sys); + actualReadFileMap = undefined; + getPrograms = undefined; + } + } + export function verifyTscBaseline(sys: () => { baseLine: TscCompileSystem["baseLine"]; }) { it(`Generates files matching the baseline`, () => { const { file, text } = sys().baseLine(); Harness.Baseline.runBaseline(file, text); }); } - - export function verifyTsc(input: TscCompile) { + export interface VerifyTscCompileLike { + scenario: string; + subScenario: string; + commandLineArgs: readonly string[]; + fs: () => vfs.FileSystem; + } + export function verifyTscCompileLike(verifier: (input: T) => { baseLine: TscCompileSystem["baseLine"]; }, input: T) { describe(`tsc ${input.commandLineArgs.join(" ")} ${input.scenario}:: ${input.subScenario}`, () => { describe(input.scenario, () => { describe(input.subScenario, () => { - let sys: TscCompileSystem; - before(() => { - sys = tscCompile({ - ...input, - fs: () => getFsWithTime(input.fs()).fs.makeReadonly() - }); - }); - after(() => { - sys = undefined!; - }); - verifyTscBaseline(() => sys); + verifyTscBaseline(() => verifier({ + ...input, + fs: () => getFsWithTime(input.fs()).fs.makeReadonly() + })); }); }); }); } + + export function verifyTsc(input: TscCompile) { + verifyTscCompileLike(tscCompile, input); + } } diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index c874c32e04b31..bde7b6c901863 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -38,7 +38,11 @@ namespace ts.tscWatch { const files = [file, configFile, libFile]; it("using createWatchOfConfigFile ", () => { const baseline = createBaseline(createWatchedSystem(files)); - const watch = createWatchOfConfigFile(configFile.path, baseline.sys); + const watch = createWatchProgram(createWatchCompilerHostOfConfigFileForBaseline({ + system: baseline.sys, + cb: baseline.cb, + configFileName: configFile.path, + })); // Initially console is cleared if --preserveOutput is not provided since the config file is yet to be parsed runWatchBaseline({ scenario, diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 881502781b80f..745946dcab26b 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -27,200 +27,6 @@ namespace ts.tscWatch { checkArray(`Program actual files`, program.getSourceFiles().map(file => file.fileName), expectedFiles); } - export function checkProgramRootFiles(program: Program, expectedFiles: readonly string[]) { - checkArray(`Program rootFileNames`, program.getRootFileNames(), expectedFiles); - } - - export type Watch = WatchOfConfigFile | WatchOfFilesAndCompilerOptions; - - export function createWatchOfConfigFile(configFileName: string, system: WatchedSystem, optionsToExtend?: CompilerOptions, watchOptionsToExtend?: WatchOptions) { - const compilerHost = createWatchCompilerHostOfConfigFile({ configFileName, optionsToExtend, watchOptionsToExtend, system }); - return createWatchProgram(compilerHost); - } - - export function createWatchOfFilesAndCompilerOptions(rootFiles: string[], system: WatchedSystem, options: CompilerOptions = {}, watchOptions?: WatchOptions) { - const compilerHost = createWatchCompilerHostOfFilesAndCompilerOptions({ rootFiles, options, watchOptions, system }); - return createWatchProgram(compilerHost); - } - - const elapsedRegex = /^Elapsed:: \d+(?:\.\d+)?ms/; - const buildVerboseLogRegEx = /^.+ \- /; - export enum HostOutputKind { - Log, - Diagnostic, - WatchDiagnostic - } - - export interface HostOutputLog { - kind: HostOutputKind.Log; - expected: string; - caption?: string; - } - - export interface HostOutputDiagnostic { - kind: HostOutputKind.Diagnostic; - diagnostic: Diagnostic | string; - } - - export interface HostOutputWatchDiagnostic { - kind: HostOutputKind.WatchDiagnostic; - diagnostic: Diagnostic | string; - } - - export type HostOutput = HostOutputLog | HostOutputDiagnostic | HostOutputWatchDiagnostic; - - export function checkOutputErrors( - host: WatchedSystem, - expected: readonly HostOutput[], - disableConsoleClears?: boolean | undefined - ) { - let screenClears = 0; - const outputs = host.getOutput(); - assert.equal(outputs.length, expected.length, JSON.stringify(outputs)); - let index = 0; - forEach(expected, expected => { - switch (expected.kind) { - case HostOutputKind.Log: - return assertLog(expected); - case HostOutputKind.Diagnostic: - return assertDiagnostic(expected); - case HostOutputKind.WatchDiagnostic: - return assertWatchDiagnostic(expected); - default: - return Debug.assertNever(expected); - } - }); - assert.equal(host.screenClears.length, screenClears, "Expected number of screen clears"); - host.clearOutput(); - - function isDiagnostic(diagnostic: Diagnostic | string): diagnostic is Diagnostic { - return !!(diagnostic as Diagnostic).messageText; - } - - function assertDiagnostic({ diagnostic }: HostOutputDiagnostic) { - const expected = isDiagnostic(diagnostic) ? formatDiagnostic(diagnostic, host) : diagnostic; - assert.equal(outputs[index], expected, getOutputAtFailedMessage("Diagnostic", expected)); - index++; - } - - function getCleanLogString(log: string) { - return log.replace(elapsedRegex, "").replace(buildVerboseLogRegEx, ""); - } - - function assertLog({ caption, expected }: HostOutputLog) { - const actual = outputs[index]; - assert.equal(getCleanLogString(actual), getCleanLogString(expected), getOutputAtFailedMessage(caption || "Log", expected)); - index++; - } - - function assertWatchDiagnostic({ diagnostic }: HostOutputWatchDiagnostic) { - if (isString(diagnostic)) { - assert.equal(outputs[index], diagnostic, getOutputAtFailedMessage("Diagnostic", diagnostic)); - } - else { - const expected = getWatchDiagnosticWithoutDate(diagnostic); - if (!disableConsoleClears && contains(screenStartingMessageCodes, diagnostic.code)) { - assert.equal(host.screenClears[screenClears], index, `Expected screen clear at this diagnostic: ${expected}`); - screenClears++; - } - assert.isTrue(endsWith(outputs[index], expected), getOutputAtFailedMessage("Watch diagnostic", expected)); - } - index++; - } - - function getOutputAtFailedMessage(caption: string, expectedOutput: string) { - return `Expected ${caption}: ${JSON.stringify(expectedOutput)} at ${index} in ${JSON.stringify(outputs)}`; - } - - function getWatchDiagnosticWithoutDate(diagnostic: Diagnostic) { - const newLines = contains(screenStartingMessageCodes, diagnostic.code) - ? `${host.newLine}${host.newLine}` - : host.newLine; - return ` - ${flattenDiagnosticMessageText(diagnostic.messageText, host.newLine)}${newLines}`; - } - } - - export function hostOutputLog(expected: string, caption?: string): HostOutputLog { - return { kind: HostOutputKind.Log, expected, caption }; - } - export function hostOutputDiagnostic(diagnostic: Diagnostic | string): HostOutputDiagnostic { - return { kind: HostOutputKind.Diagnostic, diagnostic }; - } - export function hostOutputWatchDiagnostic(diagnostic: Diagnostic | string): HostOutputWatchDiagnostic { - return { kind: HostOutputKind.WatchDiagnostic, diagnostic }; - } - - export function startingCompilationInWatchMode() { - return hostOutputWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode)); - } - export function foundErrorsWatching(errors: readonly any[]) { - return hostOutputWatchDiagnostic(errors.length === 1 ? - createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes) : - createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errors.length) - ); - } - export function fileChangeDetected() { - return hostOutputWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation)); - } - - export function checkOutputErrorsInitial(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], disableConsoleClears?: boolean, logsBeforeErrors?: string[]) { - checkOutputErrors( - host, - [ - startingCompilationInWatchMode(), - ...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")), - ...map(errors, hostOutputDiagnostic), - foundErrorsWatching(errors) - ], - disableConsoleClears - ); - } - - export function checkOutputErrorsIncremental(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) { - checkOutputErrors( - host, - [ - ...map(logsBeforeWatchDiagnostic || emptyArray, expected => hostOutputLog(expected, "logsBeforeWatchDiagnostic")), - fileChangeDetected(), - ...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")), - ...map(errors, hostOutputDiagnostic), - foundErrorsWatching(errors) - ], - disableConsoleClears - ); - } - - export function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) { - checkOutputErrors( - host, - [ - ...map(logsBeforeWatchDiagnostic || emptyArray, expected => hostOutputLog(expected, "logsBeforeWatchDiagnostic")), - fileChangeDetected(), - ...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")), - ...map(errors, hostOutputDiagnostic), - ], - disableConsoleClears - ); - assert.equal(host.exitCode, expectedExitCode); - } - - export function checkNormalBuildErrors( - host: WatchedSystem, - errors: readonly Diagnostic[] | readonly string[], - files: readonly ReportFileInError[], - reportErrorSummary?: boolean - ) { - checkOutputErrors( - host, - [ - ...map(errors, hostOutputDiagnostic), - ...reportErrorSummary ? - [hostOutputWatchDiagnostic(getErrorSummaryText(errors.length, files, host.newLine, host))] : - emptyArray - ] - ); - } - export function getDiagnosticMessageChain(message: DiagnosticMessage, args?: (string | number)[], next?: DiagnosticMessageChain[]): DiagnosticMessageChain { let text = getLocaleSpecificMessage(message); if (args?.length) { @@ -293,24 +99,25 @@ namespace ts.tscWatch { sys.checkTimeoutQueueLength(0); } - export interface TscWatchCompileChange { + export type WatchOrSolution = void | SolutionBuilder | WatchOfConfigFile | WatchOfFilesAndCompilerOptions; + export interface TscWatchCompileChange { caption: string; change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void; timeouts: ( sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, programs: readonly CommandLineProgram[], - watchOrSolution: ReturnType + watchOrSolution: WatchOrSolution ) => void; } export interface TscWatchCheckOptions { baselineSourceMap?: boolean; baselineDependencies?: boolean; } - export interface TscWatchCompileBase extends TscWatchCheckOptions { + export interface TscWatchCompileBase extends TscWatchCheckOptions { scenario: string; subScenario: string; commandLineArgs: readonly string[]; - changes: readonly TscWatchCompileChange[]; + changes: readonly TscWatchCompileChange[]; } export interface TscWatchCompile extends TscWatchCompileBase { sys: () => WatchedSystem; @@ -355,23 +162,81 @@ namespace ts.tscWatch { }); } - export interface Baseline { + export interface BaselineBase { baseline: string[]; sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; oldSnap: SystemSnap; } - export function createBaseline(system: WatchedSystem): Baseline { - const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles( - fakes.patchHostForBuildInfoReadWrite(system) - ); + export interface Baseline extends BaselineBase, CommandLineCallbacks { + } + + export function createBaseline(system: WatchedSystem, modifySystem?: (sys: WatchedSystem) => void): Baseline { + const initialSys = fakes.patchHostForBuildInfoReadWrite(system); + modifySystem?.(initialSys); + const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles(initialSys); const baseline: string[] = []; baseline.push("Input::"); sys.diff(baseline); - return { sys, baseline, oldSnap: sys.snap() }; + const { cb, getPrograms } = commandLineCallbacks(sys); + return { sys, baseline, oldSnap: sys.snap(), cb, getPrograms }; + } + + export function createSolutionBuilderWithWatchHostForBaseline(sys: WatchedSystem, cb: ExecuteCommandLineCallbacks) { + const host = createSolutionBuilderWithWatchHost(sys, + /*createProgram*/ undefined, + createDiagnosticReporter(sys, /*pretty*/ true), + createBuilderStatusReporter(sys, /*pretty*/ true), + createWatchStatusReporter(sys, /*pretty*/ true) + ); + host.afterProgramEmitAndDiagnostics = cb; + host.afterEmitBundle = cb; + return host; + } + + interface CreateWatchCompilerHostOfConfigFileForBaseline extends CreateWatchCompilerHostOfConfigFileInput { + system: WatchedSystem, + cb: ExecuteCommandLineCallbacks; + } + + export function createWatchCompilerHostOfConfigFileForBaseline( + input: CreateWatchCompilerHostOfConfigFileForBaseline + ) { + const host = createWatchCompilerHostOfConfigFile({ + ...input, + reportDiagnostic: createDiagnosticReporter(input.system, /*pretty*/ true), + reportWatchStatus: createWatchStatusReporter(input.system, /*pretty*/ true), + }); + updateWatchHostForBaseline(host, input.cb); + return host; + } + + interface CreateWatchCompilerHostOfFilesAndCompilerOptionsForBaseline extends CreateWatchCompilerHostOfFilesAndCompilerOptionsInput { + system: WatchedSystem, + cb: ExecuteCommandLineCallbacks; + } + export function createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline( + input: CreateWatchCompilerHostOfFilesAndCompilerOptionsForBaseline + ) { + const host = createWatchCompilerHostOfFilesAndCompilerOptions({ + ...input, + reportDiagnostic: createDiagnosticReporter(input.system, /*pretty*/ true), + reportWatchStatus: createWatchStatusReporter(input.system, /*pretty*/ true), + }); + updateWatchHostForBaseline(host, input.cb); + return host; + } + + function updateWatchHostForBaseline(host: WatchCompilerHost, cb: ExecuteCommandLineCallbacks) { + const emitFilesAndReportErrors = host.afterProgramCreate!; + host.afterProgramCreate = builderProgram => { + emitFilesAndReportErrors.call(host, builderProgram); + cb(builderProgram); + }; + return host; } - export function applyChange(sys: Baseline["sys"], baseline: Baseline["baseline"], change: TscWatchCompileChange["change"], caption?: TscWatchCompileChange["caption"]) { + export function applyChange(sys: BaselineBase["sys"], baseline: BaselineBase["baseline"], change: TscWatchCompileChange["change"], caption?: TscWatchCompileChange["caption"]) { const oldSnap = sys.snap(); baseline.push(`Change::${caption ? " " + caption : ""}`, ""); change(sys); @@ -380,17 +245,17 @@ namespace ts.tscWatch { return sys.snap(); } - export interface RunWatchBaseline extends Baseline, TscWatchCompileBase { + export interface RunWatchBaseline extends BaselineBase, TscWatchCompileBase { sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; getPrograms: () => readonly CommandLineProgram[]; - watchOrSolution: ReturnType; + watchOrSolution: WatchOrSolution; } - export function runWatchBaseline({ + export function runWatchBaseline({ scenario, subScenario, commandLineArgs, getPrograms, sys, baseline, oldSnap, baselineSourceMap, baselineDependencies, changes, watchOrSolution - }: RunWatchBaseline) { + }: RunWatchBaseline) { baseline.push(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}`); let programs = watchBaseline({ baseline, @@ -428,7 +293,7 @@ namespace ts.tscWatch { }); } - export interface WatchBaseline extends Baseline, TscWatchCheckOptions { + export interface WatchBaseline extends BaselineBase, TscWatchCheckOptions { oldPrograms: readonly (CommandLineProgram | undefined)[]; getPrograms: () => readonly CommandLineProgram[]; } diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 8da2d0c09c4ba..1af240764fea7 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -28,12 +28,11 @@ namespace ts.tscWatch { { subScenario, files, optionsToExtend, modifyFs }: VerifyIncrementalWatchEmitInput, incremental: boolean ) { - const { sys, baseline, oldSnap } = createBaseline(createWatchedSystem(files(), { currentDirectory: project })); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem(files(), { currentDirectory: project })); if (incremental) sys.exit = exitCode => sys.exitCode = exitCode; const argsToPass = [incremental ? "-i" : "-w", ...(optionsToExtend || emptyArray)]; baseline.push(`${sys.getExecutingFilePath()} ${argsToPass.join(" ")}`); let oldPrograms: readonly CommandLineProgram[] = emptyArray; - const { cb, getPrograms } = commandLineCallbacks(sys); build(oldSnap); if (modifyFs) { diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index ea5ab542f52a9..68f03f0d20cc4 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -511,7 +511,7 @@ export class A { }] }); - it("correctly migrate files between projects", () => { + it("two watch programs are not affected by each other", () => { const file1 = { path: "/a/b/f1.ts", content: ` @@ -526,16 +526,46 @@ export class A { path: "/a/d/f3.ts", content: "export let y = 1;" }; - const host = createWatchedSystem([file1, file2, file3]); - const watch = createWatchOfFilesAndCompilerOptions([file2.path, file3.path], host); - checkProgramActualFiles(watch.getCurrentProgram().getProgram(), [file2.path, file3.path]); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([libFile, file1, file2, file3])); + const host = createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles: [file2.path, file3.path], + system: sys, + options: { allowNonTsExtensions: true }, + cb, + watchOptions: undefined + }); + createWatchProgram(host); + baseline.push(`${sys.getExecutingFilePath()} --w ${file2.path} ${file3.path}`); + watchBaseline({ + baseline, + getPrograms, + oldPrograms: emptyArray, + sys, + oldSnap, + }); - const watch2 = createWatchOfFilesAndCompilerOptions([file1.path], host); - checkProgramActualFiles(watch2.getCurrentProgram().getProgram(), [file1.path, file2.path, file3.path]); + const {cb: cb2, getPrograms: getPrograms2 } = commandLineCallbacks(sys); + const oldSnap2 = sys.snap(); + baseline.push("createing separate watcher"); + createWatchProgram(createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles:[file1.path], + system: sys, + options: { allowNonTsExtensions: true }, + cb: cb2, + watchOptions: undefined + })); + watchBaseline({ + baseline, + getPrograms: getPrograms2, + oldPrograms: emptyArray, + sys, + oldSnap: oldSnap2, + }); - // Previous program shouldnt be updated - checkProgramActualFiles(watch.getCurrentProgram().getProgram(), [file2.path, file3.path]); - host.checkTimeoutQueueLength(0); + sys.checkTimeoutQueueLength(0); + baseline.push(`First program is not updated:: ${getPrograms() === emptyArray}`); + baseline.push(`Second program is not updated:: ${getPrograms2() === emptyArray}`); + Harness.Baseline.runBaseline(`tscWatch/${scenario}/two-watch-programs-are-not-affected-by-each-other.js`, baseline.join("\r\n")); }); verifyTscWatch({ @@ -1025,9 +1055,25 @@ declare const eval: any` path: "/a/compile", content: "let x = 1" }; - const host = createWatchedSystem([f, libFile]); - const watch = createWatchOfFilesAndCompilerOptions([f.path], host, { allowNonTsExtensions: true }); - checkProgramActualFiles(watch.getCurrentProgram().getProgram(), [f.path, libFile.path]); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([f, libFile])); + const watch = createWatchProgram(createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles: [f.path], + system: sys, + options: { allowNonTsExtensions: true }, + cb, + watchOptions: undefined + })); + runWatchBaseline({ + scenario, + subScenario: "should support files without extensions", + commandLineArgs: ["--w", f.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: emptyArray, + watchOrSolution: watch + }); }); verifyTscWatch({ diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index b8f065ae41b82..ef923e28d3cae 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -1,7 +1,7 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => { const scenario = "resolutionCache"; - it("works", () => { + it("caching works", () => { const root = { path: "/a/d/f0.ts", content: `import {x} from "f1"` @@ -11,80 +11,76 @@ namespace ts.tscWatch { content: `foo()` }; - const files = [root, imported, libFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfFilesAndCompilerOptions([root.path], host, { module: ModuleKind.AMD }); - - const f1IsNotModule = getDiagnosticOfFileFromProgram(watch.getCurrentProgram().getProgram(), root.path, root.content.indexOf('"f1"'), '"f1"'.length, Diagnostics.File_0_is_not_a_module, imported.path); - const cannotFindFoo = getDiagnosticOfFileFromProgram(watch.getCurrentProgram().getProgram(), imported.path, imported.content.indexOf("foo"), "foo".length, Diagnostics.Cannot_find_name_0, "foo"); - - // ensure that imported file was found - checkOutputErrorsInitial(host, [f1IsNotModule, cannotFindFoo]); - + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, imported, libFile])); + const host = createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles: [root.path], + system: sys, + options: { module: ModuleKind.AMD }, + cb, + watchOptions: undefined + }); const originalFileExists = host.fileExists; - { - const newContent = `import {x} from "f1" - var x: string = 1;`; - root.content = newContent; - host.writeFile(root.path, root.content); - - // patch fileExists to make sure that disk is not touched - host.fileExists = notImplemented; - - // trigger synchronization to make sure that import will be fetched from the cache - host.runQueuedTimeoutCallbacks(); - - // ensure file has correct number of errors after edit - checkOutputErrorsIncremental(host, [ - f1IsNotModule, - getDiagnosticOfFileFromProgram(watch.getCurrentProgram().getProgram(), root.path, newContent.indexOf("var x") + "var ".length, "x".length, Diagnostics.Type_0_is_not_assignable_to_type_1, "number", "string"), - cannotFindFoo - ]); - } - { - let fileExistsIsCalled = false; - host.fileExists = (fileName): boolean => { - if (fileName === "lib.d.ts") { - return false; - } - fileExistsIsCalled = true; - assert.isTrue(fileName.indexOf("/f2.") !== -1); - return originalFileExists.call(host, fileName); - }; - - root.content = `import {x} from "f2"`; - host.writeFile(root.path, root.content); - - // trigger synchronization to make sure that system will try to find 'f2' module on disk - host.runQueuedTimeoutCallbacks(); - - // ensure file has correct number of errors after edit - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch.getCurrentProgram().getProgram(), root, "f2") - ]); - - assert.isTrue(fileExistsIsCalled); - } - { - let fileExistsCalled = false; - host.fileExists = (fileName): boolean => { - if (fileName === "lib.d.ts") { - return false; - } - fileExistsCalled = true; - assert.isTrue(fileName.indexOf("/f1.") !== -1); - return originalFileExists.call(host, fileName); - }; - - const newContent = `import {x} from "f1"`; - root.content = newContent; - - host.writeFile(root.path, root.content); - host.runQueuedTimeoutCallbacks(); - - checkOutputErrorsIncremental(host, [f1IsNotModule, cannotFindFoo]); - assert.isTrue(fileExistsCalled); - } + const watch = createWatchProgram(host); + let fileExistsIsCalled = false; + runWatchBaseline({ + scenario: "resolutionCache", + subScenario: "caching works", + commandLineArgs: ["--w", root.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [ + { + caption: "Adding text doesnt re-resole the imports", + change: sys => { + // patch fileExists to make sure that disk is not touched + host.fileExists = notImplemented; + sys.writeFile(root.path, `import {x} from "f1" + var x: string = 1;`); + }, + timeouts: runQueuedTimeoutCallbacks + }, + { + caption: "Resolves f2", + change: sys => { + host.fileExists = (fileName): boolean => { + if (fileName === "lib.d.ts") { + return false; + } + fileExistsIsCalled = true; + assert.isTrue(fileName.indexOf("/f2.") !== -1); + return originalFileExists.call(host, fileName); + }; + sys.writeFile(root.path, `import {x} from "f2"`); + }, + timeouts: sys => { + sys.runQueuedTimeoutCallbacks(); + assert.isTrue(fileExistsIsCalled); + }, + }, + { + caption: "Resolve f1", + change: sys => { + fileExistsIsCalled = false; + host.fileExists = (fileName): boolean => { + if (fileName === "lib.d.ts") { + return false; + } + fileExistsIsCalled = true; + assert.isTrue(fileName.indexOf("/f1.") !== -1); + return originalFileExists.call(host, fileName); + }; + sys.writeFile(root.path, `import {x} from "f1"`); + }, + timeouts: sys => { + sys.runQueuedTimeoutCallbacks(); + assert.isTrue(fileExistsIsCalled); + } + }, + ], + watchOrSolution: watch + }); }); it("loads missing files from disk", () => { @@ -98,10 +94,15 @@ namespace ts.tscWatch { content: `export const y = 1;` }; - const files = [root, libFile]; - const host = createWatchedSystem(files); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, libFile])); + const host = createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles: [root.path], + system: sys, + options: { module: ModuleKind.AMD }, + cb, + watchOptions: undefined + }); const originalFileExists = host.fileExists; - let fileExistsCalledForBar = false; host.fileExists = fileName => { if (fileName === "lib.d.ts") { @@ -114,21 +115,30 @@ namespace ts.tscWatch { return originalFileExists.call(host, fileName); }; - const watch = createWatchOfFilesAndCompilerOptions([root.path], host, { module: ModuleKind.AMD }); - + const watch = createWatchProgram(host); assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called"); - checkOutputErrorsInitial(host, [ - getDiagnosticModuleNotFoundOfFile(watch.getCurrentProgram().getProgram(), root, "bar") - ]); - - fileExistsCalledForBar = false; - root.content = `import {y} from "bar"`; - host.writeFile(root.path, root.content); - host.writeFile(imported.path, imported.content); - - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); - assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); + runWatchBaseline({ + scenario: "resolutionCache", + subScenario: "loads missing files from disk", + commandLineArgs: ["--w", root.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [{ + caption: "write imported file", + change: sys => { + fileExistsCalledForBar = false; + sys.writeFile(root.path,`import {y} from "bar"`); + sys.writeFile(imported.path, imported.content); + }, + timeouts: sys => { + sys.runQueuedTimeoutCallbacks(); + assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); + } + }], + watchOrSolution: watch + }); }); it("should compile correctly when resolved module goes missing and then comes back (module is not part of the root)", () => { @@ -142,7 +152,14 @@ namespace ts.tscWatch { content: `export const y = 1;export const x = 10;` }; - const host = createWatchedSystem([root, libFile, imported]); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([root, imported, libFile])); + const host = createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline({ + rootFiles: [root.path], + system: sys, + options: { module: ModuleKind.AMD }, + cb, + watchOptions: undefined + }); const originalFileExists = host.fileExists; let fileExistsCalledForBar = false; host.fileExists = fileName => { @@ -154,26 +171,43 @@ namespace ts.tscWatch { } return originalFileExists.call(host, fileName); }; - - const watch = createWatchOfFilesAndCompilerOptions([root.path], host, { module: ModuleKind.AMD }); - + const watch = createWatchProgram(host); assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called"); - checkOutputErrorsInitial(host, emptyArray); - - fileExistsCalledForBar = false; - host.deleteFile(imported.path); - host.runQueuedTimeoutCallbacks(); - assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch.getCurrentProgram().getProgram(), root, "bar") - ]); - - fileExistsCalledForBar = false; - host.writeFile(imported.path, imported.content); - host.checkTimeoutQueueLengthAndRun(1); // Scheduled invalidation of resolutions - host.checkTimeoutQueueLengthAndRun(1); // Actual update - checkOutputErrorsIncremental(host, emptyArray); - assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); + runWatchBaseline({ + scenario: "resolutionCache", + subScenario: "should compile correctly when resolved module goes missing and then comes back", + commandLineArgs: ["--w", root.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [ + { + caption: "Delete imported file", + change: sys => { + fileExistsCalledForBar = false; + sys.deleteFile(imported.path); + }, + timeouts: sys => { + sys.runQueuedTimeoutCallbacks(); + assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); + }, + }, + { + caption: "Create imported file", + change: sys => { + fileExistsCalledForBar = false; + sys.writeFile(imported.path, imported.content); + }, + timeouts: sys => { + sys.checkTimeoutQueueLengthAndRun(1); // Scheduled invalidation of resolutions + sys.checkTimeoutQueueLengthAndRun(1); // Actual update + assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); + }, + }, + ], + watchOrSolution: watch + }); }); verifyTscWatch({ @@ -402,7 +436,7 @@ declare namespace myapp { change: noop, timeouts: (sys, [[oldProgram, oldBuilderProgram]], watchorSolution) => { sys.checkTimeoutQueueLength(0); - const newProgram = (watchorSolution as Watch).getProgram(); + const newProgram = (watchorSolution as WatchOfConfigFile).getProgram(); assert.strictEqual(newProgram, oldBuilderProgram, "No change so builder program should be same"); assert.strictEqual(newProgram.getProgram(), oldProgram, "No change so program should be same"); } diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 4a831626e4e22..7152c0db97d43 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -4,26 +4,37 @@ namespace ts.tscWatch { interface VerifyWatchInput { files: readonly TestFSWithWatch.FileOrFolderOrSymLink[]; config: string; - expectedProgramFiles: readonly string[]; + subScenario: string; } - function verifyWatch( - { files, config, expectedProgramFiles }: VerifyWatchInput, - alreadyBuilt: boolean - ) { - const sys = createWatchedSystem(files); - if (alreadyBuilt) { - const solutionBuilder = createSolutionBuilder(sys, [config], {}); - solutionBuilder.build(); - solutionBuilder.close(); - sys.clearOutput(); - } - const host = createWatchCompilerHostOfConfigFile({ + + function verifyWatch({ files, config, subScenario }: VerifyWatchInput, alreadyBuilt: boolean) { + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline( + createWatchedSystem(files), + alreadyBuilt ? sys => { + const solutionBuilder = createSolutionBuilder(sys, [config], {}); + solutionBuilder.build(); + solutionBuilder.close(); + sys.clearOutput(); + } : undefined + ); + const host = createWatchCompilerHostOfConfigFileForBaseline({ configFileName: config, - system: sys + system: sys, + cb, }); host.useSourceOfProjectReferenceRedirect = returnTrue; const watch = createWatchProgram(host); - checkProgramActualFiles(watch.getCurrentProgram().getProgram(), expectedProgramFiles); + runWatchBaseline({ + scenario: "sourceOfProjectReferenceRedirect", + subScenario: `${subScenario}${alreadyBuilt ? " when solution is already built" : ""}`, + commandLineArgs: ["--w", "--p", config], + sys, + baseline, + oldSnap, + getPrograms, + changes: emptyArray, + watchOrSolution: watch + }); } function verifyScenario(input: () => VerifyWatchInput) { @@ -48,7 +59,7 @@ namespace ts.tscWatch { return { files: [{ path: libFile.path, content: libContent }, baseConfig, coreTs, coreConfig, animalTs, dogTs, indexTs, animalsConfig], config: animalsConfig.path, - expectedProgramFiles: [libFile.path, indexTs.path, dogTs.path, animalTs.path, coreTs.path] + subScenario: "with simple project" }; }); }); @@ -60,6 +71,7 @@ namespace ts.tscWatch { bFoo: File; bBar: File; bSymlink: SymLink; + subScenario: string; } function verifySymlinkScenario(packages: () => Packages) { describe("when preserveSymlinks is turned off", () => { @@ -72,13 +84,13 @@ namespace ts.tscWatch { function verifySymlinkScenarioWorker(packages: () => Packages, extraOptions: CompilerOptions) { verifyScenario(() => { - const { bPackageJson, aTest, bFoo, bBar, bSymlink } = packages(); + const { bPackageJson, aTest, bFoo, bBar, bSymlink, subScenario } = packages(); const aConfig = config("A", extraOptions, ["../B"]); const bConfig = config("B", extraOptions); return { files: [libFile, bPackageJson, aConfig, bConfig, aTest, bFoo, bBar, bSymlink], config: aConfig.path, - expectedProgramFiles: [libFile.path, aTest.path, bFoo.path, bBar.path] + subScenario: `${subScenario}${extraOptions.preserveSymlinks ? " with preserveSymlinks" : ""}` }; }); } @@ -126,7 +138,8 @@ bar(); bSymlink: { path: `${projectRoot}/node_modules/${scope}b`, symLink: `${projectRoot}/packages/B` - } + }, + subScenario: `when packageJson has types field${scope ? " with scoped package" : ""}` })); }); @@ -146,7 +159,8 @@ bar(); bSymlink: { path: `${projectRoot}/node_modules/${scope}b`, symLink: `${projectRoot}/packages/B` - } + }, + subScenario: `when referencing file from subFolder${scope ? " with scoped package" : ""}` })); }); } diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index d71318d2de868..d61f49f725126 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -18,15 +18,18 @@ namespace ts.tscWatch { }; it("verify that module resolution with json extension works when returned without extension", () => { - const files = [libFile, mainFile, config, settingsJson]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const compilerHost = createWatchCompilerHostOfConfigFile({ + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem( + [libFile, mainFile, config, settingsJson], + { currentDirectory: projectRoot }), + ); + const host = createWatchCompilerHostOfConfigFileForBaseline({ configFileName: config.path, - system: host + system: sys, + cb, }); - const parsedCommandResult = parseJsonConfigFileContent(configFileJson, host, config.path); - compilerHost.resolveModuleNames = (moduleNames, containingFile) => moduleNames.map(m => { - const result = resolveModuleName(m, containingFile, parsedCommandResult.options, compilerHost); + const parsedCommandResult = parseJsonConfigFileContent(configFileJson, sys, config.path); + host.resolveModuleNames = (moduleNames, containingFile) => moduleNames.map(m => { + const result = resolveModuleName(m, containingFile, parsedCommandResult.options, host); const resolvedModule = result.resolvedModule!; return { resolvedFileName: resolvedModule.resolvedFileName, @@ -34,40 +37,62 @@ namespace ts.tscWatch { originalFileName: resolvedModule.originalPath, }; }); - const watch = createWatchProgram(compilerHost); - const program = watch.getCurrentProgram().getProgram(); - checkProgramActualFiles(program, [mainFile.path, libFile.path, settingsJson.path]); + const watch = createWatchProgram(host); + runWatchBaseline({ + scenario: "watchApi", + subScenario: "verify that module resolution with json extension works when returned without extension", + commandLineArgs: ["--w", "--p", config.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: emptyArray, + watchOrSolution: watch + }); }); }); describe("unittests:: tsc-watch:: watchAPI:: tsc-watch expose error count to watch status reporter", () => { - const configFileJson: any = { - compilerOptions: { module: "commonjs" }, - files: ["index.ts"] - }; - const config: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify(configFileJson) - }; - const mainFile: File = { - path: `${projectRoot}/index.ts`, - content: "let compiler = new Compiler(); for (let i = 0; j < 5; i++) {}" - }; - it("verify that the error count is correctly passed down to the watch status reporter", () => { - const files = [libFile, mainFile, config]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - let watchedErrorCount; - const reportWatchStatus: WatchStatusReporter = (_, __, ___, errorCount) => { - watchedErrorCount = errorCount; + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { module: "commonjs" }, + files: ["index.ts"] + }) }; - const compilerHost = createWatchCompilerHostOfConfigFile({ + const mainFile: File = { + path: `${projectRoot}/index.ts`, + content: "let compiler = new Compiler(); for (let i = 0; j < 5; i++) {}" + }; + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem( + [libFile, mainFile, config], + { currentDirectory: projectRoot }), + ); + const host = createWatchCompilerHostOfConfigFileForBaseline({ configFileName: config.path, - system: host, - reportWatchStatus + system: sys, + cb, }); - createWatchProgram(compilerHost); + const existing = host.onWatchStatusChange!; + let watchedErrorCount; + host.onWatchStatusChange = (diagnostic, newLine, options, errorCount) => { + existing.call(host, diagnostic, newLine, options, errorCount); + watchedErrorCount = errorCount; + }; + const watch = createWatchProgram(host); assert.equal(watchedErrorCount, 2, "The error count was expected to be 2 for the file change"); + runWatchBaseline({ + scenario: "watchApi", + subScenario: "verify that the error count is correctly passed down to the watch status reporter", + commandLineArgs: ["--w", "--p", config.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: emptyArray, + watchOrSolution: watch + }); }); }); @@ -81,16 +106,33 @@ namespace ts.tscWatch { path: `${projectRoot}/main.ts`, content: "const x = 10;" }; - const sys = createWatchedSystem([config, mainFile, libFile]); - const watchCompilerHost = createWatchCompilerHost(config.path, {}, sys); - watchCompilerHost.setTimeout = undefined; - watchCompilerHost.clearTimeout = undefined; - const watch = createWatchProgram(watchCompilerHost); - checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, libFile.path]); - // Write new file - const barPath = `${projectRoot}/bar.ts`; - sys.writeFile(barPath, "const y =10;"); - checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, barPath, libFile.path]); + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem([config, mainFile, libFile])); + const host = createWatchCompilerHostOfConfigFileForBaseline({ + configFileName: config.path, + system: sys, + cb, + }); + host.setTimeout = undefined; + host.clearTimeout = undefined; + const watch = createWatchProgram(host); + runWatchBaseline({ + scenario: "watchApi", + subScenario: "without timesouts on host program gets updated", + commandLineArgs: ["--w", "--p", config.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [{ + caption: "Write a file", + change: sys => sys.writeFile(`${projectRoot}/bar.ts`, "const y =10;"), + timeouts: sys => { + sys.checkTimeoutQueueLength(0); + watch.getProgram(); + } + }], + watchOrSolution: watch + }); }); }); @@ -108,139 +150,230 @@ namespace ts.tscWatch { path: `${projectRoot}/other.vue`, content: "" }; - const sys = createWatchedSystem([config, mainFile, otherFile, libFile]); - const watchCompilerHost = createWatchCompilerHost( - config.path, - { allowNonTsExtensions: true }, - sys, - /*createProgram*/ undefined, - /*reportDiagnostics*/ undefined, - /*reportWatchStatus*/ undefined, - /*watchOptionsToExtend*/ undefined, - [{ extension: ".vue", isMixedContent: true, scriptKind: ScriptKind.Deferred }] + const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline( + createWatchedSystem([config, mainFile, otherFile, libFile]) ); - const watch = createWatchProgram(watchCompilerHost); - checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path]); - - const other2 = `${projectRoot}/other2.vue`; - sys.writeFile(other2, otherFile.content); - checkSingleTimeoutQueueLengthAndRun(sys); - checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path, other2]); + const host = createWatchCompilerHostOfConfigFileForBaseline({ + configFileName: config.path, + optionsToExtend: { allowNonTsExtensions: true }, + extraFileExtensions: [{ extension: ".vue", isMixedContent: true, scriptKind: ScriptKind.Deferred }], + system: sys, + cb, + }); + const watch = createWatchProgram(host); + runWatchBaseline({ + scenario: "watchApi", + subScenario: "extraFileExtensions are supported", + commandLineArgs: ["--w", "--p", config.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [{ + caption: "Write a file", + change: sys => sys.writeFile(`${projectRoot}/other2.vue`, otherFile.content), + timeouts: checkSingleTimeoutQueueLengthAndRun, + }], + watchOrSolution: watch + }); }); }); describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticDiagnosticsBuilderProgram", () => { - function getWatch(config: File, optionsToExtend: CompilerOptions | undefined, sys: System, createProgram: CreateProgram) { - const watchCompilerHost = createWatchCompilerHost(config.path, optionsToExtend, sys, createProgram); - return createWatchProgram(watchCompilerHost); - } - - function setup(createProgram: CreateProgram, configText: string) { + function createSystem(configText: string, mainText: string) { const config: File = { path: `${projectRoot}/tsconfig.json`, content: configText }; const mainFile: File = { path: `${projectRoot}/main.ts`, - content: "export const x = 10;" + content: mainText }; const otherFile: File = { path: `${projectRoot}/other.ts`, content: "export const y = 10;" }; - const sys = createWatchedSystem([config, mainFile, otherFile, libFile]); - const watch = getWatch(config, { noEmit: true }, sys, createProgram); - return { sys, watch, mainFile, otherFile, config }; + return { + ...createBaseline(createWatchedSystem([config, mainFile, otherFile, libFile])), + config, + mainFile, + otherFile, + }; + } + + function createWatch( + baseline: string[], + config: File, + optionsToExtend: CompilerOptions | undefined, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + createProgram: CreateProgram + ) { + const { cb, getPrograms } = commandLineCallbacks(sys); + baseline.push(`tsc --w${optionsToExtend?.noEmit ? " --noEmit" : ""}`); + const oldSnap = sys.snap(); + const host = createWatchCompilerHostOfConfigFileForBaseline({ + configFileName: config.path, + optionsToExtend, + createProgram, + system: sys, + cb, + }); + const watch = createWatchProgram(host); + watchBaseline({ + baseline, + getPrograms, + oldPrograms: emptyArray, + sys, + oldSnap, + }); + watch.close(); } - function verifyOutputs(sys: System, emitSys: System) { + function verifyOutputs(baseline: string[], sys: System, emitSys: System) { + baseline.push("Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram::"); for (const output of [`${projectRoot}/main.js`, `${projectRoot}/main.d.ts`, `${projectRoot}/other.js`, `${projectRoot}/other.d.ts`, `${projectRoot}/tsconfig.tsbuildinfo`]) { - assert.strictEqual(sys.readFile(output), emitSys.readFile(output), `Output file text for ${output}`); + baseline.push(`Output file text for ${output} is same:: ${sys.readFile(output) === emitSys.readFile(output)}`); } + baseline.push(""); } - function verifyBuilder(config: File, sys: System, emitSys: System, createProgram: CreateProgram, createEmitProgram: CreateProgram, optionsToExtend?: CompilerOptions) { - const watch = getWatch(config, /*optionsToExtend*/ optionsToExtend, sys, createProgram); - const emitWatch = getWatch(config, /*optionsToExtend*/ optionsToExtend, emitSys, createEmitProgram); - verifyOutputs(sys, emitSys); - watch.close(); - emitWatch.close(); + function createSystemForBuilderTest(configText: string, mainText: string) { + const result = createSystem(configText, mainText); + const { sys: emitSys, baseline: emitBaseline } = createSystem(configText, mainText); + return { ...result, emitSys, emitBaseline }; + } + + function applyChangeForBuilderTest( + baseline: string[], + emitBaseline: string[], + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + change: (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles) => void, + caption: string + ) { + // Change file + applyChange(sys, baseline, change, caption); + applyChange(emitSys, emitBaseline, change, caption); + } + + function verifyBuilder( + baseline: string[], + emitBaseline: string[], + config: File, + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + emitSys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, + createProgram: CreateProgram, + optionsToExtend?: CompilerOptions) { + createWatch(baseline, config, optionsToExtend, sys, createProgram); + createWatch(emitBaseline, config, optionsToExtend, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram); + verifyOutputs(baseline, sys, emitSys); } it("verifies that noEmit is handled on createSemanticDiagnosticsBuilderProgram and typechecking happens only on affected files", () => { - const { sys, watch, mainFile, otherFile } = setup(createSemanticDiagnosticsBuilderProgram, "{}"); - checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path]); - sys.appendFile(mainFile.path, "\n// SomeComment"); - sys.runQueuedTimeoutCallbacks(); - const program = watch.getProgram().getProgram(); - assert.deepEqual(program.getCachedSemanticDiagnostics(program.getSourceFile(mainFile.path)), []); - // Should not retrieve diagnostics for other file thats not changed - assert.deepEqual(program.getCachedSemanticDiagnostics(program.getSourceFile(otherFile.path)), /*expected*/ undefined); + const { sys, baseline, oldSnap, cb, getPrograms, config, mainFile } = createSystem("{}", "export const x = 10;"); + const host = createWatchCompilerHostOfConfigFileForBaseline({ + configFileName: config.path, + optionsToExtend: { noEmit: true }, + createProgram: createSemanticDiagnosticsBuilderProgram, + system: sys, + cb, + }); + const watch = createWatchProgram(host); + runWatchBaseline({ + scenario: "watchApi", + subScenario: "verifies that noEmit is handled on createSemanticDiagnosticsBuilderProgram", + commandLineArgs: ["--w", "--p", config.path], + sys, + baseline, + oldSnap, + getPrograms, + changes: [{ + caption: "Modify a file", + change: sys => sys.appendFile(mainFile.path, "\n// SomeComment"), + timeouts: runQueuedTimeoutCallbacks, + }], + watchOrSolution: watch + }); }); - it("noEmit with composite writes the tsbuildinfo with pending affected files correctly", () => { - const configText = JSON.stringify({ compilerOptions: { composite: true } }); - const { sys, watch, config, mainFile } = setup(createSemanticDiagnosticsBuilderProgram, configText); - const { sys: emitSys, watch: emitWatch } = setup(createEmitAndSemanticDiagnosticsBuilderProgram, configText); - verifyOutputs(sys, emitSys); + describe("noEmit with composite writes the tsbuildinfo with pending affected files correctly", () => { + let baseline: string[]; + let emitBaseline: string[]; + before(() => { + const configText = JSON.stringify({ compilerOptions: { composite: true } }); + const mainText = "export const x = 10;"; + const result = createSystemForBuilderTest(configText, mainText); + baseline = result.baseline; + emitBaseline = result.emitBaseline; + const { sys, config, mainFile, emitSys } = result; - watch.close(); - emitWatch.close(); + // No Emit + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmit: true }); - // Emit on both sys should result in same output - verifyBuilder(config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + // Emit on both sys should result in same output + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram); - // Change file - sys.appendFile(mainFile.path, "\n// SomeComment"); - emitSys.appendFile(mainFile.path, "\n// SomeComment"); + // Change file + applyChangeForBuilderTest(baseline, emitBaseline, sys, emitSys, sys => sys.appendFile(mainFile.path, "\n// SomeComment"), "Add comment"); - // Verify noEmit results in same output - verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmit: true }); + // Verify noEmit results in same output + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, { noEmit: true }); - // Emit on both sys should result in same output - verifyBuilder(config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + // Emit on both sys should result in same output + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram); - // Change file - sys.appendFile(mainFile.path, "\n// SomeComment"); - emitSys.appendFile(mainFile.path, "\n// SomeComment"); + // Change file + applyChangeForBuilderTest(baseline, emitBaseline, sys, emitSys, sys => sys.appendFile(mainFile.path, "\n// SomeComment"), "Add comment"); - // Emit on both the builders should result in same files - verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + // Emit on both the builders should result in same files + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createSemanticDiagnosticsBuilderProgram); + }); + after(() => { + baseline = undefined!; + emitBaseline = undefined!; + }); + it("noEmit with composite writes the tsbuildinfo with pending affected files correctly", () => { + Harness.Baseline.runBaseline(`tscWatch/watchApi/noEmit-with-composite-with-semantic-builder.js`, baseline.join("\r\n")); + }); + it("baseline in createEmitAndSemanticDiagnosticsBuilderProgram:: noEmit with composite writes the tsbuildinfo with pending affected files correctly", () => { + Harness.Baseline.runBaseline(`tscWatch/watchApi/noEmit-with-composite-with-emit-builder.js`, emitBaseline.join("\r\n")); + }); }); - it("noEmitOnError with composite writes the tsbuildinfo with pending affected files correctly", () => { - const config: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true } }) - }; - const mainFile: File = { - path: `${projectRoot}/main.ts`, - content: "export const x: string = 10;" - }; - const otherFile: File = { - path: `${projectRoot}/other.ts`, - content: "export const y = 10;" - }; - const sys = createWatchedSystem([config, mainFile, otherFile, libFile]); - const emitSys = createWatchedSystem([config, mainFile, otherFile, libFile]); + describe("noEmitOnError with composite writes the tsbuildinfo with pending affected files correctly", () => { + let baseline: string[]; + let emitBaseline: string[]; + before(() => { + const configText = JSON.stringify({ compilerOptions: { composite: true, noEmitOnError: true } }); + const mainText = "export const x: string = 10;"; + const result = createSystemForBuilderTest(configText, mainText); + baseline = result.baseline; + emitBaseline = result.emitBaseline; + const { sys, config, mainFile, emitSys } = result; - // Verify noEmit results in same output - verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); + // Verify noEmit results in same output + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createSemanticDiagnosticsBuilderProgram); - // Change file - sys.appendFile(mainFile.path, "\n// SomeComment"); - emitSys.appendFile(mainFile.path, "\n// SomeComment"); + // Change file + applyChangeForBuilderTest(baseline, emitBaseline, sys, emitSys, sys => sys.appendFile(mainFile.path, "\n// SomeComment"), "Add comment"); - // Verify noEmit results in same output - verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); + // Verify noEmit results in same output + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createSemanticDiagnosticsBuilderProgram); - // Fix error - const fixed = "export const x = 10;"; - sys.appendFile(mainFile.path, fixed); - emitSys.appendFile(mainFile.path, fixed); + // Fix error + const fixed = "export const x = 10;"; + applyChangeForBuilderTest(baseline, emitBaseline, sys, emitSys, sys => sys.writeFile(mainFile.path, fixed), "Fix error"); - // Emit on both the builders should result in same files - verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); + // Emit on both the builders should result in same files + verifyBuilder(baseline, emitBaseline, config, sys, emitSys, createSemanticDiagnosticsBuilderProgram); + }); + + it("noEmitOnError with composite writes the tsbuildinfo with pending affected files correctly", () => { + Harness.Baseline.runBaseline(`tscWatch/watchApi/noEmitOnError-with-composite-with-semantic-builder.js`, baseline.join("\r\n")); + }); + it("baseline in createEmitAndSemanticDiagnosticsBuilderProgram:: noEmitOnError with composite writes the tsbuildinfo with pending affected files correctly", () => { + Harness.Baseline.runBaseline(`tscWatch/watchApi/noEmitOnError-with-composite-with-emit-builder.js`, emitBaseline.join("\r\n")); + }); }); }); @@ -282,9 +415,10 @@ namespace ts.tscWatch { }; const system = createWatchedSystem([config1, class1, class1Dts, config2, class2, libFile]); const baseline = createBaseline(system); - const compilerHost = createWatchCompilerHostOfConfigFile({ - configFileName: config2.path, + const compilerHost = createWatchCompilerHostOfConfigFileForBaseline({ + cb: baseline.cb, system, + configFileName: config2.path, optionsToExtend: { extendedDiagnostics: true } }); compilerHost.useSourceOfProjectReferenceRedirect = useSourceOfProjectReferenceRedirect; @@ -312,7 +446,6 @@ namespace ts.tscWatch { subScenario: "when new file is added to the referenced project with host implementing getParsedCommandLine", commandLineArgs: ["--w", "-p", config2.path, "--extendedDiagnostics"], ...baseline, - getPrograms: () => [[watch.getCurrentProgram().getProgram(), watch.getCurrentProgram()]], changes: [ { caption: "Add class3 to project1", @@ -344,7 +477,6 @@ namespace ts.tscWatch { subScenario: "when new file is added to the referenced project with host implementing getParsedCommandLine without implementing useSourceOfProjectReferenceRedirect", commandLineArgs: ["--w", "-p", config2.path, "--extendedDiagnostics"], ...baseline, - getPrograms: () => [[watch.getCurrentProgram().getProgram(), watch.getCurrentProgram()]], changes: [ { caption: "Add class3 to project1", diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/builds-till-project-specified.js b/tests/baselines/reference/tsbuild/outFile/initial-build/builds-till-project-specified.js new file mode 100644 index 0000000000000..f4a5c3417ea06 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/builds-till-project-specified.js @@ -0,0 +1,157 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/first/first_PART1.ts] + + +//// [/src/first/first_part2.ts] + + +//// [/src/first/first_part3.ts] + + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "outFile": "./bin/first-output.js", + "skipDefaultLibCheck": true, + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/second/second_part1.ts] +namespace N { + // Comment text +} + +namespace N { + function f() { + console.log('testing'); + } + + f(); +} + + +//// [/src/second/second_part2.ts] +class C { + doSomething() { + console.log("something got done"); + } +} + + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "../2/second-output.js", + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/src/third/third_part1.ts] + + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "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 }, + ] +} + + + + +Output:: +/lib/tsc --build /src/second/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":"4.7.0-dev"} + diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/cleans-till-project-specified.js b/tests/baselines/reference/tsbuild/outFile/initial-build/cleans-till-project-specified.js new file mode 100644 index 0000000000000..250a854a535cf --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/cleans-till-project-specified.js @@ -0,0 +1,142 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/src/2/second-output.d.ts] + + +//// [/src/2/second-output.d.ts.map] + + +//// [/src/2/second-output.js] + + +//// [/src/2/second-output.js.map] + + +//// [/src/2/second-output.tsbuildinfo] + + +//// [/src/first/bin/first-output.d.ts] + + +//// [/src/first/bin/first-output.d.ts.map] + + +//// [/src/first/bin/first-output.js] + + +//// [/src/first/bin/first-output.js.map] + + +//// [/src/first/bin/first-output.tsbuildinfo] + + +//// [/src/first/first_PART1.ts] + + +//// [/src/first/first_part2.ts] + + +//// [/src/first/first_part3.ts] + + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "outFile": "./bin/first-output.js", + "skipDefaultLibCheck": true, + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/second/second_part1.ts] + + +//// [/src/second/second_part2.ts] + + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "../2/second-output.js", + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/src/third/thirdjs/output/third-output.d.ts] + + +//// [/src/third/thirdjs/output/third-output.d.ts.map] + + +//// [/src/third/thirdjs/output/third-output.js] + + +//// [/src/third/thirdjs/output/third-output.js.map] + + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] + + +//// [/src/third/third_part1.ts] + + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "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 }, + ] +} + + + + +Output:: +/lib/tsc --build --clean /src/second/tsconfig.json +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 diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-command-line-incremental-flag-changes-between-non-dts-changes.js b/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-command-line-incremental-flag-changes-between-non-dts-changes.js new file mode 100644 index 0000000000000..ffa2d94ede782 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-command-line-incremental-flag-changes-between-non-dts-changes.js @@ -0,0 +1,1020 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/first/first_part2.ts] +console.log(f()); + + +//// [/src/first/first_part3.ts] +function f() { + return "JS does hoists"; +} + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "outFile": "./bin/first-output.js", + "skipDefaultLibCheck": true, + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/second/second_part1.ts] +namespace N { + // Comment text +} + +namespace N { + function f() { + console.log('testing'); + } + + f(); +} + + +//// [/src/second/second_part2.ts] +class C { + doSomething() { + console.log("something got done"); + } +} + + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "../2/second-output.js", + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/src/third/third_part1.ts] +var c = new C(); +c.doSomething(); + + +//// [/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 }, + ] +} + + + + +Output:: +/lib/tsc --b /src/third --i --verbose +[12:01:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:01:00 AM] Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +[12:01:00 AM] Building project '/src/first/tsconfig.json'... + +[12:01:00 AM] Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +[12:01:00 AM] Building project '/src/second/tsconfig.json'... + +[12:01: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:01: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/2/second-output.tsbuildinfo.readable.baseline.txt] +{ + "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", + "size": 255 +} + +//// [/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/first/bin/first-output.tsbuildinfo.readable.baseline.txt] +{ + "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", + "size": 252 +} + +//// [/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/thirdjs/output/third-output.tsbuildinfo] +{"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":395,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":395,"kind":"text"}]},{"pos":395,"end":431,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":257,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":257,"kind":"text"}]},{"pos":257,"end":276,"kind":"text"}]}},"version":"FakeTSVersion"} + +//// [/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; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.readable.baseline.txt] +{ + "bundle": { + "commonSourceDirectory": "../..", + "sourceFiles": [ + "../../third_part1.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "prepend", + "data": "../../../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + { + "pos": 110, + "end": 395, + "kind": "prepend", + "data": "../../../2/second-output.js", + "texts": [ + { + "pos": 110, + "end": 395, + "kind": "text" + } + ] + }, + { + "pos": 395, + "end": 431, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../../../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 257, + "kind": "prepend", + "data": "../../../2/second-output.d.ts", + "texts": [ + { + "pos": 157, + "end": 257, + "kind": "text" + } + ] + }, + { + "pos": 257, + "end": 276, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion", + "size": 720 +} + + + +Change:: Make non incremental build with change in file that doesnt affect dts +Input:: +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); +console.log(s); + + + +Output:: +/lib/tsc --b /src/third --verbose +[12:04:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:04:00 AM] Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +[12:04:00 AM] Building project '/src/first/tsconfig.json'... + +[12:04: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:04:00 AM] Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +[12:04:00 AM] Building 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] +var s = "Hello, world"; +console.log(s); +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;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACXf,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":127,"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-127) +var s = "Hello, world"; +console.log(s); +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/first/bin/first-output.tsbuildinfo.readable.baseline.txt] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 127, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion", + "size": 252 +} + +//// [/src/third/thirdjs/output/third-output.d.ts] file written with same contents +//// [/src/third/thirdjs/output/third-output.d.ts.map] file written with same contents +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hello, world"; +console.log(s); +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;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACXf,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"} + + + +Change:: Make incremental build with change in file that doesnt affect dts +Input:: +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); +console.log(s);console.log(s); + + + +Output:: +/lib/tsc --b /src/third --verbose --incremental +[12:07:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:07:00 AM] Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +[12:07:00 AM] Building project '/src/first/tsconfig.json'... + +[12:07: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:07:00 AM] Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.tsbuildinfo' is older than newest input 'src/first' + +[12:07:00 AM] Building 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] +var s = "Hello, world"; +console.log(s); +console.log(s); +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;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACX9B,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":144,"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-144) +var s = "Hello, world"; +console.log(s); +console.log(s); +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/first/bin/first-output.tsbuildinfo.readable.baseline.txt] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 144, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion", + "size": 252 +} + +//// [/src/third/thirdjs/output/third-output.d.ts] file written with same contents +//// [/src/third/thirdjs/output/third-output.d.ts.map] file written with same contents +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hello, world"; +console.log(s); +console.log(s); +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;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACX9B,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/thirdjs/output/third-output.tsbuildinfo] +{"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":144,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":144,"kind":"text"}]},{"pos":144,"end":429,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":144,"end":429,"kind":"text"}]},{"pos":429,"end":465,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":257,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":257,"kind":"text"}]},{"pos":257,"end":276,"kind":"text"}]}},"version":"FakeTSVersion"} + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/third/thirdjs/output/third-output.js +---------------------------------------------------------------------- +prepend: (0-144):: ../../../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-144) +var s = "Hello, world"; +console.log(s); +console.log(s); +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +prepend: (144-429):: ../../../2/second-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (144-429) +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: (429-465) +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; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.readable.baseline.txt] +{ + "bundle": { + "commonSourceDirectory": "../..", + "sourceFiles": [ + "../../third_part1.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 144, + "kind": "prepend", + "data": "../../../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 144, + "kind": "text" + } + ] + }, + { + "pos": 144, + "end": 429, + "kind": "prepend", + "data": "../../../2/second-output.js", + "texts": [ + { + "pos": 144, + "end": 429, + "kind": "text" + } + ] + }, + { + "pos": 429, + "end": 465, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../../../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 257, + "kind": "prepend", + "data": "../../../2/second-output.d.ts", + "texts": [ + { + "pos": 157, + "end": 257, + "kind": "text" + } + ] + }, + { + "pos": 257, + "end": 276, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion", + "size": 720 +} + diff --git a/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js b/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js new file mode 100644 index 0000000000000..541b0b92292be --- /dev/null +++ b/tests/baselines/reference/tsbuild/outFile/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js @@ -0,0 +1,250 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/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] + + +//// [/src/2/second-output.js] + + +//// [/src/2/second-output.js.map] + + +//// [/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/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] + + +//// [/src/first/bin/first-output.js] + + +//// [/src/first/bin/first-output.js.map] + + +//// [/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/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/first/first_part2.ts] +console.log(f()); + + +//// [/src/first/first_part3.ts] +function f() { + return "JS does hoists"; +} + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "outFile": "./bin/first-output.js", + "skipDefaultLibCheck": true, + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/second/second_part1.ts] +namespace N { + // Comment text +} + +namespace N { + function f() { + console.log('testing'); + } + + f(); +} + + +//// [/src/second/second_part2.ts] +class C { + doSomething() { + console.log("something got done"); + } +} + + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "../2/second-output.js", + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/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] + + +//// [/src/third/thirdjs/output/third-output.js] + + +//// [/src/third/thirdjs/output/third-output.js.map] + + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] +{"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":395,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":395,"kind":"text"}]},{"pos":395,"end":431,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":257,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":257,"kind":"text"}]},{"pos":257,"end":276,"kind":"text"}]}},"version":"FakeTSVersion"} + +//// [/src/third/third_part1.ts] +var c = new C(); +c.doSomething(); + + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "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 }, + ] +} + + + + +Output:: +/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 for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +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 for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +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 for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +12:00:00 AM - Building project '/src/third/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/2/second-output.d.ts] file written with same contents +//// [/src/2/second-output.d.ts.map] file written with same contents +//// [/src/2/second-output.js] file written with same contents +//// [/src/2/second-output.js.map] file written with same contents +//// [/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":"FakeTSCurrentVersion"} + +//// [/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] +{"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":"FakeTSCurrentVersion"} + +//// [/src/third/thirdjs/output/third-output.d.ts] file written with same contents +//// [/src/third/thirdjs/output/third-output.d.ts.map] file written with same contents +//// [/src/third/thirdjs/output/third-output.js] file written with same contents +//// [/src/third/thirdjs/output/third-output.js.map] file written with same contents +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] +{"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":395,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":395,"kind":"text"}]},{"pos":395,"end":431,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":257,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":257,"kind":"text"}]},{"pos":257,"end":276,"kind":"text"}]}},"version":"FakeTSCurrentVersion"} + diff --git a/tests/baselines/reference/tsbuild/sample1/building-using-getNextInvalidatedProject.js b/tests/baselines/reference/tsbuild/sample1/building-using-getNextInvalidatedProject.js new file mode 100644 index 0000000000000..88764c1e9d23f --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/building-using-getNextInvalidatedProject.js @@ -0,0 +1,188 @@ +Input:: +Output:: + +//// [/user/username/projects/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/core/some_decl.d.ts] +declare const dts: any; + + +//// [/user/username/projects/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Project Result:: {"project":"/user/username/projects/core/tsconfig.json","result":0} +Output:: + +//// [/user/username/projects/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = void 0; +exports.World = "hello"; + + +//// [/user/username/projects/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/core/index.js] +"use strict"; +exports.__esModule = true; +exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/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"} + +//// [/user/username/projects/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 + +//// [/user/username/projects/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} + + +Project Result:: {"project":"/user/username/projects/logic/tsconfig.json","result":0} +Output:: + +//// [/user/username/projects/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"} + +//// [/user/username/projects/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.m = exports.getSecondsInDay = void 0; +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 + +//// [/user/username/projects/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +Project Result:: {"project":"/user/username/projects/tests/tsconfig.json","result":0} +Output:: + +//// [/user/username/projects/tests/index.js] +"use strict"; +exports.__esModule = true; +exports.m = void 0; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5]},"version":"FakeTSVersion"} + + +Project Result:: {} +Output:: + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/building-project-in-not-build-order-doesnt-throw-error.js b/tests/baselines/reference/tsbuild/sample1/initial-build/building-project-in-not-build-order-doesnt-throw-error.js new file mode 100644 index 0000000000000..f2f73d399f083 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/building-project-in-not-build-order-doesnt-throw-error.js @@ -0,0 +1,72 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/src/core/anotherModule.ts] + + +//// [/src/core/index.ts] + + +//// [/src/core/some_decl.d.ts] + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/logic/index.ts] + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --build /src/logic2/tsconfig.json +exitCode:: ExitStatus.InvalidProject_OutputsSkipped + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/building-using-buildReferencedProject.js b/tests/baselines/reference/tsbuild/sample1/initial-build/building-using-buildReferencedProject.js new file mode 100644 index 0000000000000..ea390c9a31512 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/building-using-buildReferencedProject.js @@ -0,0 +1,169 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/core/anotherModule.ts] +export const World = "hello"; + + +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/src/core/some_decl.d.ts] +declare const dts: any; + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --build /src/logic2/tsconfig.json +12:00:00 AM - Projects in this build: + * src/core/tsconfig.json + * src/logic/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'... + +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 = void 0; +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.multiply = exports.leftPad = exports.someString = void 0; +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":{"fileNames":["../../lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"4.7.0-dev"} + +//// [/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; +exports.m = exports.getSecondsInDay = void 0; +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":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"4.7.0-dev"} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/builds-till-project-specified.js b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-till-project-specified.js new file mode 100644 index 0000000000000..ceeb083726198 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/builds-till-project-specified.js @@ -0,0 +1,157 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/core/anotherModule.ts] +export const World = "hello"; + + +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/src/core/some_decl.d.ts] +declare const dts: any; + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --build /src/logic/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 = void 0; +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.multiply = exports.leftPad = exports.someString = void 0; +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":{"fileNames":["../../lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"4.7.0-dev"} + +//// [/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; +exports.m = exports.getSecondsInDay = void 0; +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":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"4.7.0-dev"} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/cleaning-project-in-not-build-order-doesnt-throw-error.js b/tests/baselines/reference/tsbuild/sample1/initial-build/cleaning-project-in-not-build-order-doesnt-throw-error.js new file mode 100644 index 0000000000000..b68bc0aba1c0e --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/cleaning-project-in-not-build-order-doesnt-throw-error.js @@ -0,0 +1,83 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/src/core/anotherModule.d.ts] + + +//// [/src/core/anotherModule.d.ts.map] + + +//// [/src/core/anotherModule.js] + + +//// [/src/core/anotherModule.ts] + + +//// [/src/core/index.d.ts] + + +//// [/src/core/index.d.ts.map] + + +//// [/src/core/index.js] + + +//// [/src/core/index.ts] + + +//// [/src/core/some_decl.d.ts] + + +//// [/src/core/tsconfig.json] + + +//// [/src/core/tsconfig.tsbuildinfo] + + +//// [/src/logic/index.d.ts] + + +//// [/src/logic/index.js] + + +//// [/src/logic/index.js.map] + + +//// [/src/logic/index.ts] + + +//// [/src/logic/tsconfig.json] + + +//// [/src/logic/tsconfig.tsbuildinfo] + + +//// [/src/tests/index.d.ts] + + +//// [/src/tests/index.js] + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] + + +//// [/src/tests/tsconfig.tsbuildinfo] + + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --b /src/logic2 --clean +exitCode:: ExitStatus.InvalidProject_OutputsSkipped + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/cleans-till-project-specified.js b/tests/baselines/reference/tsbuild/sample1/initial-build/cleans-till-project-specified.js new file mode 100644 index 0000000000000..45ca7a6246891 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/cleans-till-project-specified.js @@ -0,0 +1,83 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/src/core/anotherModule.d.ts] + + +//// [/src/core/anotherModule.d.ts.map] + + +//// [/src/core/anotherModule.js] + + +//// [/src/core/anotherModule.ts] + + +//// [/src/core/index.d.ts] + + +//// [/src/core/index.d.ts.map] + + +//// [/src/core/index.js] + + +//// [/src/core/index.ts] + + +//// [/src/core/some_decl.d.ts] + + +//// [/src/core/tsconfig.json] + + +//// [/src/core/tsconfig.tsbuildinfo] + + +//// [/src/logic/index.d.ts] + + +//// [/src/logic/index.js] + + +//// [/src/logic/index.js.map] + + +//// [/src/logic/index.ts] + + +//// [/src/logic/tsconfig.json] + + +//// [/src/logic/tsconfig.tsbuildinfo] + + +//// [/src/tests/index.d.ts] + + +//// [/src/tests/index.js] + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] + + +//// [/src/tests/tsconfig.tsbuildinfo] + + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --b /src/logic --clean +exitCode:: ExitStatus.InvalidProject_OutputsSkipped + + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-rebuild-if-there-is-no-program-and-bundle-in-the-ts-build-info-event-if-version-doesnt-match-ts-version.js b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-rebuild-if-there-is-no-program-and-bundle-in-the-ts-build-info-event-if-version-doesnt-match-ts-version.js new file mode 100644 index 0000000000000..9fb88a5e854b0 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-rebuild-if-there-is-no-program-and-bundle-in-the-ts-build-info-event-if-version-doesnt-match-ts-version.js @@ -0,0 +1,125 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/src/core/anotherModule.d.ts] + + +//// [/src/core/anotherModule.d.ts.map] + + +//// [/src/core/anotherModule.js] + + +//// [/src/core/anotherModule.ts] + + +//// [/src/core/index.d.ts] + + +//// [/src/core/index.d.ts.map] + + +//// [/src/core/index.js] + + +//// [/src/core/index.ts] + + +//// [/src/core/some_decl.d.ts] + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/core/tsconfig.tsbuildinfo] +{"version":"FakeTSVersion"} + +//// [/src/logic/index.d.ts] + + +//// [/src/logic/index.js] + + +//// [/src/logic/index.js.map] + + +//// [/src/logic/index.ts] + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/logic/tsconfig.tsbuildinfo] +{"version":"FakeTSVersion"} + +//// [/src/tests/index.d.ts] + + +//// [/src/tests/index.js] + + +//// [/src/tests/index.ts] + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/tests/tsconfig.tsbuildinfo] +{"version":"FakeTSVersion"} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/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 up to date because newest input 'src/core/anotherModule.ts' is older than oldest output 'src/core/anotherModule.js' + +12:00: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:00: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/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js b/tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js new file mode 100644 index 0000000000000..0f5bec7c50416 --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js @@ -0,0 +1,191 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] + + +//// [/src/core/anotherModule.js] + + +//// [/src/core/anotherModule.ts] +export const 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] + + +//// [/src/core/index.js] + + +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/src/core/some_decl.d.ts] +declare const dts: any; + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"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] + + +//// [/src/logic/index.js.map] + + +//// [/src/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] + + +//// [/src/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n","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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5]},"version":"FakeTSVersion"} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/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 for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +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 for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +12:00:00 AM - Building project '/src/logic/tsconfig.json'... + +12:00:00 AM - Project 'src/tests/tsconfig.json' is out of date because output for it was generated with version 'FakeTSVersion' that differs with current version 'FakeTSCurrentVersion' + +12:00: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] +{"program":{"fileNames":["../../lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSCurrentVersion"} + +//// [/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] +{"program":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSCurrentVersion"} + +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-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","7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map","-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n","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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5]},"version":"FakeTSCurrentVersion"} + diff --git a/tests/baselines/reference/tsbuild/sample1/invalidates-projects-correctly.js b/tests/baselines/reference/tsbuild/sample1/invalidates-projects-correctly.js new file mode 100644 index 0000000000000..a17ef3b4182cc --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/invalidates-projects-correctly.js @@ -0,0 +1,270 @@ +Build of project +Output:: + +//// [/user/username/projects/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/core/some_decl.d.ts] +declare const dts: any; + + +//// [/user/username/projects/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = void 0; +exports.World = "hello"; + + +//// [/user/username/projects/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/core/index.js] +"use strict"; +exports.__esModule = true; +exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/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"} + +//// [/user/username/projects/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 + +//// [/user/username/projects/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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",{"version":"-9253692965-declare const dts: any;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/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"} + +//// [/user/username/projects/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.m = exports.getSecondsInDay = void 0; +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 + +//// [/user/username/projects/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/tests/index.js] +"use strict"; +exports.__esModule = true; +exports.m = void 0; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5]},"version":"FakeTSVersion"} + + +Project should still be upto date: UpToDate +non Dts change to logic:: After rebuilding logicConfig +Output:: + +//// [/user/username/projects/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; +function foo() {} + +//// [/user/username/projects/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;AACrB,SAAS,GAAG,KAAI,CAAC"} + +//// [/user/username/projects/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.m = exports.getSecondsInDay = void 0; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +function foo() { } +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/logic/index.d.ts] file written with same contents +//// [/user/username/projects/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"-2207004071-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\nfunction foo() {}","signature":"-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n"}],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3],[3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,2]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +non Dts change to logic:: After building next project +Output:: + +//// [/user/username/projects/tests/index.js] file changed its modified time +//// [/user/username/projects/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/tests/tsconfig.tsbuildinfo] file changed its modified time + +Dts change to Logic:: After rebuilding logicConfig +Output:: + +//// [/user/username/projects/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; +function foo() {}export class cNew {} + +//// [/user/username/projects/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;AACrB,SAAS,GAAG,KAAI,CAAC;AAAA;IAAA;IAAmB,CAAC;IAAD,WAAC;AAAD,CAAC,AAApB,IAAoB;AAAP,oBAAI"} + +//// [/user/username/projects/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.cNew = exports.m = exports.getSecondsInDay = void 0; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +function foo() { } +var cNew = /** @class */ (function () { + function cNew() { + } + return cNew; +}()); +exports.cNew = cNew; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; +export declare class cNew { +} + + +//// [/user/username/projects/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"-5994214602-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\nfunction foo() {}export class cNew {}","signature":"-10890883855-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare class cNew {\n}\n"}],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3],[3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,2]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +Dts change to Logic:: After building next project +Output:: + +//// [/user/username/projects/tests/index.js] file written with same contents +//// [/user/username/projects/tests/index.d.ts] file written with same contents +//// [/user/username/projects/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-10890883855-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare class cNew {\n}\n",{"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":"2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n"}],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,1]],"semanticDiagnosticsPerFile":[1,3,2,4,5]},"version":"FakeTSVersion"} + diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/verify-building-references-watches-only-those-projects.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/verify-building-references-watches-only-those-projects.js new file mode 100644 index 0000000000000..2400cdfd5cd1b --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/verify-building-references-watches-only-those-projects.js @@ -0,0 +1,340 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + + +/a/lib/tsc.js --b --w +Output:: +>> Screen clear +[12:00:45 AM] Starting compilation in watch mode... + +[12:01:12 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/sample1/core/anothermodule.ts (used version) +/user/username/projects/sample1/core/index.ts (used version) + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/sample1/core/index.d.ts (used version) +/user/username/projects/sample1/core/anothermodule.d.ts (used version) +/user/username/projects/sample1/logic/index.ts (used version) + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"fileName":"/user/username/projects/sample1/core/tsconfig.json","pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"fileName":"/user/username/projects/sample1/core/anotherModule.ts","pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"fileName":"/user/username/projects/sample1/core/index.ts","pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"fileName":"/user/username/projects/sample1/logic/tsconfig.json","pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"fileName":"/user/username/projects/sample1/logic/index.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"directoryName":"/user/username/projects/sample1/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"directoryName":"/user/username/projects/sample1/logic","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = void 0; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/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"} + +//// [/user/username/projects/sample1/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 + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","./anothermodule.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-2676574883-export const World = \"hello\";\r\n","-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"],"options":{"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-2676574883-export const World = \"hello\";\r\n" + }, + "./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": "-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" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 964 +} + +//// [/user/username/projects/sample1/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"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.m = exports.getSecondsInDay = void 0; +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 + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","-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"],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.d.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\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": "-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" + } + }, + "options": { + "composite": true, + "declaration": true, + "skipDefaultLibCheck": true, + "sourceMap": true + }, + "referencedMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1293 +} + diff --git a/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects-with-single-watcher-per-file.js b/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects-with-single-watcher-per-file.js new file mode 100644 index 0000000000000..004678648fceb --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects-with-single-watcher-per-file.js @@ -0,0 +1,555 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10; + +//// [/user/username/projects/myproject/pkg0/index.ts] +export const pkg0 = 0; + +//// [/user/username/projects/myproject/pkg0/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg1/index.ts] +export const pkg1 = 1; + +//// [/user/username/projects/myproject/pkg1/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg2/index.ts] +export const pkg2 = 2; + +//// [/user/username/projects/myproject/pkg2/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg3/index.ts] +export const pkg3 = 3; + +//// [/user/username/projects/myproject/pkg3/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[{"path":"./pkg0"},{"path":"./pkg1"},{"path":"./pkg2"},{"path":"./pkg3"}]} + + +/a/lib/tsc.js --b --w +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:48 AM] Projects in this build: + * pkg0/tsconfig.json + * pkg1/tsconfig.json + * pkg2/tsconfig.json + * pkg3/tsconfig.json + * tsconfig.json + +[12:00:49 AM] Project 'pkg0/tsconfig.json' is out of date because output file 'pkg0/index.js' does not exist + +[12:00:50 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:00:53 AM] Project 'pkg1/tsconfig.json' is out of date because output file 'pkg1/index.js' does not exist + +[12:00:54 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:00:57 AM] Project 'pkg2/tsconfig.json' is out of date because output file 'pkg2/index.js' does not exist + +[12:00:58 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:01 AM] Project 'pkg3/tsconfig.json' is out of date because output file 'pkg3/index.js' does not exist + +[12:01:02 AM] Building project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:05 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg0/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg1/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg2/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg3/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg3/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg3/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg3/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg3/index.ts: + {"fileName":"/user/username/projects/myproject/pkg3/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg3: + {"directoryName":"/user/username/projects/myproject/pkg3","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg0 = void 0; +exports.pkg0 = 0; + + +//// [/user/username/projects/myproject/pkg1/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg1 = void 0; +exports.pkg1 = 1; + + +//// [/user/username/projects/myproject/pkg2/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg2 = void 0; +exports.pkg2 = 2; + + +//// [/user/username/projects/myproject/pkg3/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg3 = void 0; +exports.pkg3 = 3; + + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10;export const typing1 = 10; + + +Output:: +>> Screen clear +[12:01:09 AM] File change detected. Starting incremental compilation... + +[12:01:10 AM] Project 'pkg0/tsconfig.json' is out of date because oldest output 'pkg0/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:11 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:13 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:14 AM] Project 'pkg1/tsconfig.json' is out of date because oldest output 'pkg1/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:15 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:17 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:18 AM] Project 'pkg2/tsconfig.json' is out of date because oldest output 'pkg2/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:19 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:21 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:22 AM] Project 'pkg3/tsconfig.json' is out of date because oldest output 'pkg3/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:23 AM] Building project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:25 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:26 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg3/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg3/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg3/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg3/index.ts: + {"fileName":"/user/username/projects/myproject/pkg3/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg3: + {"directoryName":"/user/username/projects/myproject/pkg3","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg1/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg2/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg3/index.js] file changed its modified time + +Change:: change pkg references + +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[{"path":"./pkg0"},{"path":"./pkg1"},{"path":"./pkg2"}]} + + +Output:: +>> Screen clear +[12:01:30 AM] File change detected. Starting incremental compilation... + +[12:01:31 AM] Found 0 errors. Watching for file changes. + + + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10; + + +Output:: +>> Screen clear +[12:01:35 AM] File change detected. Starting incremental compilation... + +[12:01:36 AM] Project 'pkg0/tsconfig.json' is out of date because oldest output 'pkg0/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:37 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:39 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:40 AM] Project 'pkg1/tsconfig.json' is out of date because oldest output 'pkg1/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:41 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:43 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:44 AM] Project 'pkg2/tsconfig.json' is out of date because oldest output 'pkg2/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:45 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:47 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:48 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg1/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg2/index.js] file changed its modified time + +Change:: change pkg references to remove all watches + +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[]} + + +Output:: +>> Screen clear +[12:01:52 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:10 - error TS18002: The 'files' list in config file '/user/username/projects/myproject/tsconfig.json' is empty. + +1 {"files":[],"include":[],"references":[]} +   ~~ + +[12:01:53 AM] Found 1 error. Watching for file changes. + + + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10;export const typing1 = 10; + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects.js b/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects.js new file mode 100644 index 0000000000000..86e8b55819ffe --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/watchEnvironment/same-file-in-multiple-projects.js @@ -0,0 +1,565 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10; + +//// [/user/username/projects/myproject/pkg0/index.ts] +export const pkg0 = 0; + +//// [/user/username/projects/myproject/pkg0/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg1/index.ts] +export const pkg1 = 1; + +//// [/user/username/projects/myproject/pkg1/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg2/index.ts] +export const pkg2 = 2; + +//// [/user/username/projects/myproject/pkg2/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/pkg3/index.ts] +export const pkg3 = 3; + +//// [/user/username/projects/myproject/pkg3/tsconfig.json] +{"complerOptions":{"composite":true},"include":["**/*.ts","../typings/xterm.d.ts"]} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[{"path":"./pkg0"},{"path":"./pkg1"},{"path":"./pkg2"},{"path":"./pkg3"}]} + + +/a/lib/tsc.js --b --w +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:48 AM] Projects in this build: + * pkg0/tsconfig.json + * pkg1/tsconfig.json + * pkg2/tsconfig.json + * pkg3/tsconfig.json + * tsconfig.json + +[12:00:49 AM] Project 'pkg0/tsconfig.json' is out of date because output file 'pkg0/index.js' does not exist + +[12:00:50 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:00:53 AM] Project 'pkg1/tsconfig.json' is out of date because output file 'pkg1/index.js' does not exist + +[12:00:54 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:00:57 AM] Project 'pkg2/tsconfig.json' is out of date because output file 'pkg2/index.js' does not exist + +[12:00:58 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:01 AM] Project 'pkg3/tsconfig.json' is out of date because output file 'pkg3/index.js' does not exist + +[12:01:02 AM] Building project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:05 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg0/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg1/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg2/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg3/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/pkg3/index.ts (used version) +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg3/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg3/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg3/index.ts: + {"fileName":"/user/username/projects/myproject/pkg3/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg3: + {"directoryName":"/user/username/projects/myproject/pkg3","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg0 = void 0; +exports.pkg0 = 0; + + +//// [/user/username/projects/myproject/pkg1/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg1 = void 0; +exports.pkg1 = 1; + + +//// [/user/username/projects/myproject/pkg2/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg2 = void 0; +exports.pkg2 = 2; + + +//// [/user/username/projects/myproject/pkg3/index.js] +"use strict"; +exports.__esModule = true; +exports.pkg3 = void 0; +exports.pkg3 = 3; + + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10;export const typing1 = 10; + + +Output:: +>> Screen clear +[12:01:09 AM] File change detected. Starting incremental compilation... + +[12:01:10 AM] Project 'pkg0/tsconfig.json' is out of date because oldest output 'pkg0/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:11 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:13 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:14 AM] Project 'pkg1/tsconfig.json' is out of date because oldest output 'pkg1/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:15 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:17 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:18 AM] Project 'pkg2/tsconfig.json' is out of date because oldest output 'pkg2/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:19 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:21 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:22 AM] Project 'pkg3/tsconfig.json' is out of date because oldest output 'pkg3/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:23 AM] Building project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:25 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg3/tsconfig.json'... + +[12:01:26 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg3/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg3/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg3/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg3/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg3/index.ts: + {"fileName":"/user/username/projects/myproject/pkg3/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg3: + {"directoryName":"/user/username/projects/myproject/pkg3","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg1/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg2/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg3/index.js] file changed its modified time + +Change:: change pkg references + +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[{"path":"./pkg0"},{"path":"./pkg1"},{"path":"./pkg2"}]} + + +Output:: +>> Screen clear +[12:01:30 AM] File change detected. Starting incremental compilation... + +[12:01:31 AM] Found 0 errors. Watching for file changes. + + + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10; + + +Output:: +>> Screen clear +[12:01:35 AM] File change detected. Starting incremental compilation... + +[12:01:36 AM] Project 'pkg0/tsconfig.json' is out of date because oldest output 'pkg0/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:37 AM] Building project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:39 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg0/tsconfig.json'... + +[12:01:40 AM] Project 'pkg1/tsconfig.json' is out of date because oldest output 'pkg1/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:41 AM] Building project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:43 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg1/tsconfig.json'... + +[12:01:44 AM] Project 'pkg2/tsconfig.json' is out of date because oldest output 'pkg2/index.js' is older than newest input 'typings/xterm.d.ts' + +[12:01:45 AM] Building project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:47 AM] Updating unchanged output timestamps of project '/user/username/projects/myproject/pkg2/tsconfig.json'... + +[12:01:48 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/pkg0/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg0/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg0/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg1/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg1/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg1/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +Program root files: ["/user/username/projects/myproject/pkg2/index.ts","/user/username/projects/myproject/typings/xterm.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/pkg2/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/pkg2/index.ts +/user/username/projects/myproject/typings/xterm.d.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/typings/xterm.d.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/pkg0/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg0/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg0/index.ts: + {"fileName":"/user/username/projects/myproject/pkg0/index.ts","pollingInterval":250} +/user/username/projects/myproject/typings/xterm.d.ts: + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/typings/xterm.d.ts","pollingInterval":250} +/user/username/projects/myproject/pkg1/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg1/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg1/index.ts: + {"fileName":"/user/username/projects/myproject/pkg1/index.ts","pollingInterval":250} +/user/username/projects/myproject/pkg2/tsconfig.json: + {"fileName":"/user/username/projects/myproject/pkg2/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/pkg2/index.ts: + {"fileName":"/user/username/projects/myproject/pkg2/index.ts","pollingInterval":250} +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/pkg0: + {"directoryName":"/user/username/projects/myproject/pkg0","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg1: + {"directoryName":"/user/username/projects/myproject/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/pkg2: + {"directoryName":"/user/username/projects/myproject/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/pkg0/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg1/index.js] file changed its modified time +//// [/user/username/projects/myproject/pkg2/index.js] file changed its modified time + +Change:: change pkg references to remove all watches + +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"files":[],"include":[],"references":[]} + + +Output:: +>> Screen clear +[12:01:52 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:10 - error TS18002: The 'files' list in config file '/user/username/projects/myproject/tsconfig.json' is empty. + +1 {"files":[],"include":[],"references":[]} +   ~~ + +[12:01:53 AM] Found 1 error. Watching for file changes. + + + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + + +Change:: modify typing file + +Input:: +//// [/user/username/projects/myproject/typings/xterm.d.ts] +export const typing = 10;export const typing1 = 10; + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js index 7daae0bf3857d..a4c8914f1a168 100644 --- a/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js +++ b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js @@ -22,10 +22,10 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --w -p /tsconfig.json Output:: >> Screen clear -12:00:13 AM - Starting compilation in watch mode... +[12:00:13 AM] Starting compilation in watch mode... +[12:00:16 AM] Found 0 errors. Watching for file changes. -12:00:16 AM - Found 0 errors. Watching for file changes. Program root files: ["/f.ts","/a/lib/lib.d.ts"] @@ -71,11 +71,10 @@ Input:: Output:: +[12:00:19 AM] File change detected. Starting incremental compilation... -12:00:19 AM - File change detected. Starting incremental compilation... +[12:00:23 AM] Found 0 errors. Watching for file changes. - -12:00:23 AM - Found 0 errors. Watching for file changes. Program root files: ["/f.ts","/a/lib/lib.d.ts"] diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-support-files-without-extensions.js b/tests/baselines/reference/tscWatch/programUpdates/should-support-files-without-extensions.js new file mode 100644 index 0000000000000..b365633a6644f --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-support-files-without-extensions.js @@ -0,0 +1,58 @@ +Input:: +//// [/a/compile] +let x = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w /a/compile +Output:: +>> Screen clear +[12:00:11 AM] Starting compilation in watch mode... + +[12:00:14 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/compile"] +Program options: {"allowNonTsExtensions":true} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/compile + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/compile + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/compile (used version) + +WatchedFiles:: +/a/compile: + {"fileName":"/a/compile","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +//// [/a/compile.js] +var x = 1; + + diff --git a/tests/baselines/reference/tscWatch/programUpdates/two-watch-programs-are-not-affected-by-each-other.js b/tests/baselines/reference/tscWatch/programUpdates/two-watch-programs-are-not-affected-by-each-other.js new file mode 100644 index 0000000000000..e14955f6cc7ca --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/two-watch-programs-are-not-affected-by-each-other.js @@ -0,0 +1,157 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/f1.ts] + + export * from "../c/f2"; + export * from "../d/f3"; + +//// [/a/c/f2.ts] +export let x = 1; + +//// [/a/d/f3.ts] +export let y = 1; + + +/a/lib/tsc.js --w /a/c/f2.ts /a/d/f3.ts +Output:: +>> Screen clear +[12:00:21 AM] Starting compilation in watch mode... + +[12:00:26 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/c/f2.ts","/a/d/f3.ts"] +Program options: {"allowNonTsExtensions":true} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/c/f2.ts +/a/d/f3.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/c/f2.ts +/a/d/f3.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/c/f2.ts (used version) +/a/d/f3.ts (used version) + +WatchedFiles:: +/a/c/f2.ts: + {"fileName":"/a/c/f2.ts","pollingInterval":250} +/a/d/f3.ts: + {"fileName":"/a/d/f3.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +//// [/a/c/f2.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 1; + + +//// [/a/d/f3.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 1; + + + +createing separate watcher +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +[12:00:36 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/b/f1.ts"] +Program options: {"allowNonTsExtensions":true} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/c/f2.ts +/a/d/f3.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/c/f2.ts +/a/d/f3.ts +/a/b/f1.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/c/f2.ts (used version) +/a/d/f3.ts (used version) +/a/b/f1.ts (used version) + +WatchedFiles:: +/a/c/f2.ts: + {"fileName":"/a/c/f2.ts","pollingInterval":250} + {"fileName":"/a/c/f2.ts","pollingInterval":250} +/a/d/f3.ts: + {"fileName":"/a/d/f3.ts","pollingInterval":250} + {"fileName":"/a/d/f3.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/a/b/f1.ts: + {"fileName":"/a/b/f1.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +//// [/a/c/f2.js] file written with same contents +//// [/a/d/f3.js] file written with same contents +//// [/a/b/f1.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; +__exportStar(require("../c/f2"), exports); +__exportStar(require("../d/f3"), exports); + + + +First program is not updated:: true +Second program is not updated:: true \ No newline at end of file diff --git a/tests/baselines/reference/tscWatch/resolutionCache/caching-works.js b/tests/baselines/reference/tscWatch/resolutionCache/caching-works.js new file mode 100644 index 0000000000000..64d57dfe2a7f4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/caching-works.js @@ -0,0 +1,275 @@ +Input:: +//// [/a/d/f0.ts] +import {x} from "f1" + +//// [/a/f1.ts] +foo() + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w /a/d/f0.ts +Output:: +>> Screen clear +[12:00:15 AM] Starting compilation in watch mode... + +a/d/f0.ts:1:17 - error TS2306: File '/a/f1.ts' is not a module. + +1 import {x} from "f1" +   ~~~~ + +a/f1.ts:1:1 - error TS2304: Cannot find name 'foo'. + +1 foo() +  ~~~ + +[12:00:20 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/a/d/f0.ts"] +Program options: {"module":2} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/f1.ts +/a/d/f0.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/f1.ts +/a/d/f0.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/f1.ts (used version) +/a/d/f0.ts (used version) + +WatchedFiles:: +/a/d/f0.ts: + {"fileName":"/a/d/f0.ts","pollingInterval":250} +/a/f1.ts: + {"fileName":"/a/f1.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/f1.js] +foo(); + + +//// [/a/d/f0.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + + +Change:: Adding text doesnt re-resole the imports + +Input:: +//// [/a/d/f0.ts] +import {x} from "f1" + var x: string = 1; + + +Output:: +>> Screen clear +[12:00:24 AM] File change detected. Starting incremental compilation... + +a/d/f0.ts:1:17 - error TS2306: File '/a/f1.ts' is not a module. + +1 import {x} from "f1" +   ~~~~ + +a/d/f0.ts:2:33 - error TS2322: Type 'number' is not assignable to type 'string'. + +2 var x: string = 1; +   ~ + +a/f1.ts:1:1 - error TS2304: Cannot find name 'foo'. + +1 foo() +  ~~~ + +[12:00:28 AM] Found 3 errors. Watching for file changes. + + + +Program root files: ["/a/d/f0.ts"] +Program options: {"module":2} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/a/f1.ts +/a/d/f0.ts + +Semantic diagnostics in builder refreshed for:: +/a/d/f0.ts + +Shape signatures in builder refreshed for:: +/a/d/f0.ts (computed .d.ts) + +WatchedFiles:: +/a/d/f0.ts: + {"fileName":"/a/d/f0.ts","pollingInterval":250} +/a/f1.ts: + {"fileName":"/a/f1.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/d/f0.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + var x = 1; +}); + + + +Change:: Resolves f2 + +Input:: +//// [/a/d/f0.ts] +import {x} from "f2" + + +Output:: +>> Screen clear +[12:00:32 AM] File change detected. Starting incremental compilation... + +a/d/f0.ts:1:17 - error TS2792: Cannot find module 'f2'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +1 import {x} from "f2" +   ~~~~ + +[12:00:36 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/a/d/f0.ts"] +Program options: {"module":2} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/a/d/f0.ts + +Semantic diagnostics in builder refreshed for:: +/a/d/f0.ts + +Shape signatures in builder refreshed for:: +/a/d/f0.ts (computed .d.ts) + +WatchedFiles:: +/a/d/f0.ts: + {"fileName":"/a/d/f0.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: +/: + {"directoryName":"","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/node_modules: + {"directoryName":"/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/d/f0.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + + +Change:: Resolve f1 + +Input:: +//// [/a/d/f0.ts] +import {x} from "f1" + + +Output:: +>> Screen clear +[12:00:40 AM] File change detected. Starting incremental compilation... + +a/d/f0.ts:1:17 - error TS2306: File '/a/f1.ts' is not a module. + +1 import {x} from "f1" +   ~~~~ + +a/f1.ts:1:1 - error TS2304: Cannot find name 'foo'. + +1 foo() +  ~~~ + +[12:00:47 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/a/d/f0.ts"] +Program options: {"module":2} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/a/f1.ts +/a/d/f0.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/f1.ts +/a/d/f0.ts + +Shape signatures in builder refreshed for:: +/a/f1.ts (computed .d.ts) +/a/d/f0.ts (computed .d.ts) + +WatchedFiles:: +/a/d/f0.ts: + {"fileName":"/a/d/f0.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/a/f1.ts: + {"fileName":"/a/f1.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/f1.js] file written with same contents +//// [/a/d/f0.js] file written with same contents diff --git a/tests/baselines/reference/tscWatch/resolutionCache/loads-missing-files-from-disk.js b/tests/baselines/reference/tscWatch/resolutionCache/loads-missing-files-from-disk.js new file mode 100644 index 0000000000000..c13df4fd4be34 --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/loads-missing-files-from-disk.js @@ -0,0 +1,124 @@ +Input:: +//// [/a/foo.ts] +import {x} from "bar" + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w /a/foo.ts +Output:: +>> Screen clear +[12:00:11 AM] Starting compilation in watch mode... + +a/foo.ts:1:17 - error TS2792: Cannot find module 'bar'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +1 import {x} from "bar" +   ~~~~~ + +[12:00:14 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/a/foo.ts"] +Program options: {"module":2} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/foo.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/foo.ts (used version) + +WatchedFiles:: +/a/foo.ts: + {"fileName":"/a/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: +/: + {"directoryName":"","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/node_modules: + {"directoryName":"/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/foo.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + + +Change:: write imported file + +Input:: +//// [/a/foo.ts] +import {y} from "bar" + +//// [/a/bar.d.ts] +export const y = 1; + + +Output:: +>> Screen clear +[12:00:20 AM] File change detected. Starting incremental compilation... + +[12:00:24 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/foo.ts"] +Program options: {"module":2} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/a/bar.d.ts +/a/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/bar.d.ts +/a/foo.ts + +Shape signatures in builder refreshed for:: +/a/bar.d.ts (used version) +/a/foo.ts (computed .d.ts) + +WatchedFiles:: +/a/foo.ts: + {"fileName":"/a/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/a/bar.d.ts: + {"fileName":"/a/bar.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/foo.js] file written with same contents diff --git a/tests/baselines/reference/tscWatch/resolutionCache/should-compile-correctly-when-resolved-module-goes-missing-and-then-comes-back.js b/tests/baselines/reference/tscWatch/resolutionCache/should-compile-correctly-when-resolved-module-goes-missing-and-then-comes-back.js new file mode 100644 index 0000000000000..40374b75d6da9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/should-compile-correctly-when-resolved-module-goes-missing-and-then-comes-back.js @@ -0,0 +1,171 @@ +Input:: +//// [/a/foo.ts] +import {x} from "bar" + +//// [/a/bar.d.ts] +export const y = 1;export const x = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w /a/foo.ts +Output:: +>> Screen clear +[12:00:13 AM] Starting compilation in watch mode... + +[12:00:16 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/foo.ts"] +Program options: {"module":2} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/bar.d.ts +/a/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/bar.d.ts +/a/foo.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/a/bar.d.ts (used version) +/a/foo.ts (used version) + +WatchedFiles:: +/a/foo.ts: + {"fileName":"/a/foo.ts","pollingInterval":250} +/a/bar.d.ts: + {"fileName":"/a/bar.d.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/foo.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + + +Change:: Delete imported file + +Input:: +//// [/a/bar.d.ts] deleted + +Output:: +>> Screen clear +[12:00:18 AM] File change detected. Starting incremental compilation... + +a/foo.ts:1:17 - error TS2792: Cannot find module 'bar'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +1 import {x} from "bar" +   ~~~~~ + +[12:00:22 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/a/foo.ts"] +Program options: {"module":2} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/a/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/foo.ts + +Shape signatures in builder refreshed for:: +/a/foo.ts (computed .d.ts) + +WatchedFiles:: +/a/foo.ts: + {"fileName":"/a/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: +/: + {"directoryName":"","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/node_modules: + {"directoryName":"/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/foo.js] file written with same contents + +Change:: Create imported file + +Input:: +//// [/a/bar.d.ts] +export const y = 1;export const x = 10; + + +Output:: +>> Screen clear +[12:00:25 AM] File change detected. Starting incremental compilation... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/a/foo.ts"] +Program options: {"module":2} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/a/bar.d.ts +/a/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/bar.d.ts +/a/foo.ts + +Shape signatures in builder refreshed for:: +/a/bar.d.ts (used version) +/a/foo.ts (computed .d.ts) + +WatchedFiles:: +/a/foo.ts: + {"fileName":"/a/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/a/bar.d.ts: + {"fileName":"/a/bar.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"directoryName":"/a","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/a/foo.js] file written with same contents diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-when-solution-is-already-built.js new file mode 100644 index 0000000000000..665b7cbac069a --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-when-solution-is-already-built.js @@ -0,0 +1,212 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from 'b'; +import { bar } from 'b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/bar.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/index.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/index.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"1045484683-export function bar() { }","4646078106-export function foo() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("b"); +var bar_1 = require("b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/lib/index.d.ts","../b/lib/bar.d.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:05 AM] Starting compilation in watch mode... + +[12:01:15 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 948 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks-when-solution-is-already-built.js new file mode 100644 index 0000000000000..5ad338edf8d7b --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks-when-solution-is-already-built.js @@ -0,0 +1,212 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from 'b'; +import { bar } from 'b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/bar.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/index.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/index.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"1045484683-export function bar() { }","4646078106-export function foo() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("b"); +var bar_1 = require("b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../node_modules/b/lib/index.d.ts","../../node_modules/b/lib/bar.d.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:05 AM] Starting compilation in watch mode... + +[12:01:15 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 948 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks.js new file mode 100644 index 0000000000000..203755bc3fd76 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-preserveSymlinks.js @@ -0,0 +1,187 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from 'b'; +import { bar } from 'b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:43 AM] Starting compilation in watch mode... + +[12:00:53 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("b"); +var bar_1 = require("b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n", + "signature": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 902 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-when-solution-is-already-built.js new file mode 100644 index 0000000000000..403b35aa392e6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-when-solution-is-already-built.js @@ -0,0 +1,212 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from '@issue/b'; +import { bar } from '@issue/b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/bar.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/index.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/index.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"1045484683-export function bar() { }","4646078106-export function foo() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("@issue/b"); +var bar_1 = require("@issue/b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/lib/index.d.ts","../b/lib/bar.d.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:07 AM] Starting compilation in watch mode... + +[12:01:17 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 962 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js new file mode 100644 index 0000000000000..2aeceebba0e4e --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js @@ -0,0 +1,212 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from '@issue/b'; +import { bar } from '@issue/b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/bar.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/index.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/index.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"1045484683-export function bar() { }","4646078106-export function foo() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("@issue/b"); +var bar_1 = require("@issue/b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../node_modules/@issue/b/lib/index.d.ts","../../node_modules/@issue/b/lib/bar.d.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:07 AM] Starting compilation in watch mode... + +[12:01:17 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 962 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks.js new file mode 100644 index 0000000000000..3e4cd0265c0cf --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package-with-preserveSymlinks.js @@ -0,0 +1,187 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from '@issue/b'; +import { bar } from '@issue/b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:45 AM] Starting compilation in watch mode... + +[12:00:55 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("@issue/b"); +var bar_1 = require("@issue/b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n", + "signature": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 916 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package.js new file mode 100644 index 0000000000000..4676094b37d82 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field-with-scoped-package.js @@ -0,0 +1,187 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from '@issue/b'; +import { bar } from '@issue/b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:45 AM] Starting compilation in watch mode... + +[12:00:55 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("@issue/b"); +var bar_1 = require("@issue/b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n", + "signature": "8545527381-import { foo } from '@issue/b';\nimport { bar } from '@issue/b/lib/bar';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 916 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field.js new file mode 100644 index 0000000000000..35c1e9ff9790a --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-packageJson-has-types-field.js @@ -0,0 +1,187 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{"main":"lib/index.js","types":"lib/index.d.ts"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/index.ts] +import { foo } from 'b'; +import { bar } from 'b/lib/bar'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/index.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:43 AM] Starting compilation in watch mode... + +[12:00:53 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/index.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/index.ts +/user/username/projects/myproject/packages/B/src/bar.ts +/user/username/projects/myproject/packages/A/src/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/index.ts (used version) +/user/username/projects/myproject/packages/b/src/bar.ts (used version) +/user/username/projects/myproject/packages/a/src/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/index.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/index.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/index.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("b"); +var bar_1 = require("b/lib/bar"); +(0, b_1.foo)(); +(0, bar_1.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/index.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/index.ts","../b/src/bar.ts","./src/index.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/index.ts", + "../b/src/bar.ts", + "./src/index.ts" + ], + "fileNamesList": [ + [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/index.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/index.ts": { + "version": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n", + "signature": "3563314629-import { foo } from 'b';\nimport { bar } from 'b/lib/bar';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "exportedModulesMap": { + "./src/index.ts": [ + "../b/src/index.ts", + "../b/src/bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/index.ts", + "../b/src/bar.ts", + "../b/src/index.ts" + ] + }, + "version": "FakeTSVersion", + "size": 902 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-when-solution-is-already-built.js new file mode 100644 index 0000000000000..765128a7cfdec --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-when-solution-is-already-built.js @@ -0,0 +1,214 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from 'b/lib/foo'; +import { bar } from 'b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/foo.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/foo.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/foo.ts","./src/bar/foo.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("b/lib/foo"); +var foo_2 = require("b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/lib/foo.d.ts","../b/lib/bar/foo.d.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:10 AM] Starting compilation in watch mode... + +[12:01:20 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 962 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks-when-solution-is-already-built.js new file mode 100644 index 0000000000000..e7b0a69e369d1 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks-when-solution-is-already-built.js @@ -0,0 +1,214 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from 'b/lib/foo'; +import { bar } from 'b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/foo.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/foo.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/foo.ts","./src/bar/foo.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("b/lib/foo"); +var foo_2 = require("b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../node_modules/b/lib/foo.d.ts","../../node_modules/b/lib/bar/foo.d.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:10 AM] Starting compilation in watch mode... + +[12:01:20 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 962 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks.js new file mode 100644 index 0000000000000..a6aa5ac0f6622 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-preserveSymlinks.js @@ -0,0 +1,189 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from 'b/lib/foo'; +import { bar } from 'b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:45 AM] Starting compilation in watch mode... + +[12:00:55 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("b/lib/foo"); +var foo_2 = require("b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 916 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-when-solution-is-already-built.js new file mode 100644 index 0000000000000..0a4cef0edff9d --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-when-solution-is-already-built.js @@ -0,0 +1,214 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from '@issue/b/lib/foo'; +import { bar } from '@issue/b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/foo.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/foo.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/foo.ts","./src/bar/foo.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("@issue/b/lib/foo"); +var foo_2 = require("@issue/b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/lib/foo.d.ts","../b/lib/bar/foo.d.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:12 AM] Starting compilation in watch mode... + +[12:01:22 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 977 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js new file mode 100644 index 0000000000000..0b94e4fdea4a4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks-when-solution-is-already-built.js @@ -0,0 +1,214 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from '@issue/b/lib/foo'; +import { bar } from '@issue/b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) +//// [/user/username/projects/myproject/packages/B/lib/foo.js] +"use strict"; +exports.__esModule = true; +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + +//// [/user/username/projects/myproject/packages/B/lib/foo.d.ts] +export declare function foo(): void; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.js] +"use strict"; +exports.__esModule = true; +exports.bar = void 0; +function bar() { } +exports.bar = bar; + + +//// [/user/username/projects/myproject/packages/B/lib/bar/foo.d.ts] +export declare function bar(): void; + + +//// [/user/username/projects/myproject/packages/B/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","./src/foo.ts","./src/bar/foo.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("@issue/b/lib/foo"); +var foo_2 = require("@issue/b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../node_modules/@issue/b/lib/foo.d.ts","../../node_modules/@issue/b/lib/bar/foo.d.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-5677608893-export declare function foo(): void;\n","-2904461644-export declare function bar(): void;\n","-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:01:12 AM] Starting compilation in watch mode... + +[12:01:22 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (computed .d.ts) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] file written with same contents +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] file written with same contents +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }",{"version":"-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n","signature":"-3531856636-export {};\n"}],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-3531856636-export {};\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 977 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks.js new file mode 100644 index 0000000000000..fee6d4d90e60e --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package-with-preserveSymlinks.js @@ -0,0 +1,189 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true,"preserveSymlinks":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from '@issue/b/lib/foo'; +import { bar } from '@issue/b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:57 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"preserveSymlinks":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("@issue/b/lib/foo"); +var foo_2 = require("@issue/b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 931 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package.js new file mode 100644 index 0000000000000..f4a1b0eb7a015 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder-with-scoped-package.js @@ -0,0 +1,189 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from '@issue/b/lib/foo'; +import { bar } from '@issue/b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/@issue/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:57 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("@issue/b/lib/foo"); +var foo_2 = require("@issue/b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "-20350237855-import { foo } from '@issue/b/lib/foo';\nimport { bar } from '@issue/b/lib/bar/foo';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 931 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder.js new file mode 100644 index 0000000000000..8f46cda300e3a --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/when-referencing-file-from-subFolder.js @@ -0,0 +1,189 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/packages/B/package.json] +{} + +//// [/user/username/projects/myproject/packages/A/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"],"references":[{"path":"../B"}]} + +//// [/user/username/projects/myproject/packages/B/tsconfig.json] +{"compilerOptions":{"outDir":"lib","rootDir":"src","composite":true},"include":["src"]} + +//// [/user/username/projects/myproject/packages/A/src/test.ts] +import { foo } from 'b/lib/foo'; +import { bar } from 'b/lib/bar/foo'; +foo(); +bar(); + + +//// [/user/username/projects/myproject/packages/B/src/foo.ts] +export function foo() { } + +//// [/user/username/projects/myproject/packages/B/src/bar/foo.ts] +export function bar() { } + +//// [/user/username/projects/myproject/node_modules/b] symlink(/user/username/projects/myproject/packages/B) + +/a/lib/tsc.js --w --p /user/username/projects/myproject/packages/A/tsconfig.json +Output:: +>> Screen clear +[12:00:45 AM] Starting compilation in watch mode... + +[12:00:55 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/packages/A/src/test.ts"] +Program options: {"outDir":"/user/username/projects/myproject/packages/A/lib","rootDir":"/user/username/projects/myproject/packages/A/src","composite":true,"configFilePath":"/user/username/projects/myproject/packages/A/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/packages/B/src/foo.ts +/user/username/projects/myproject/packages/B/src/bar/foo.ts +/user/username/projects/myproject/packages/A/src/test.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/packages/b/src/foo.ts (used version) +/user/username/projects/myproject/packages/b/src/bar/foo.ts (used version) +/user/username/projects/myproject/packages/a/src/test.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/packages/a/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/A/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/tsconfig.json: + {"fileName":"/user/username/projects/myproject/packages/B/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/packages/a/src/test.ts: + {"fileName":"/user/username/projects/myproject/packages/A/src/test.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/foo.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/src/bar/foo.ts: + {"fileName":"/user/username/projects/myproject/packages/B/src/bar/foo.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/foo/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/package.json","pollingInterval":250} +/user/username/projects/myproject/packages/b/lib/bar/foo/package.json: + {"fileName":"/user/username/projects/myproject/packages/b/lib/bar/foo/package.json","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/packages/b/src: + {"directoryName":"/user/username/projects/myproject/packages/b/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/src: + {"directoryName":"/user/username/projects/myproject/packages/A/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + {"directoryName":"/user/username/projects/myproject/packages/a/src","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules: + {"directoryName":"/user/username/projects/myproject/packages/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/a/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/A/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/packages/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/packages/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/packages/A/lib/test.js] +"use strict"; +exports.__esModule = true; +var foo_1 = require("b/lib/foo"); +var foo_2 = require("b/lib/bar/foo"); +(0, foo_1.foo)(); +(0, foo_2.bar)(); + + +//// [/user/username/projects/myproject/packages/A/lib/test.d.ts] +export {}; + + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../b/src/foo.ts","../b/src/bar/foo.ts","./src/test.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"4646078106-export function foo() { }","1045484683-export function bar() { }","14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n"],"options":{"composite":true,"outDir":"./lib","rootDir":"./src"},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"exportedModulesMap":[[4,1]],"semanticDiagnosticsPerFile":[1,4,3,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/packages/A/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../b/src/foo.ts", + "../b/src/bar/foo.ts", + "./src/test.ts" + ], + "fileNamesList": [ + [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../b/src/foo.ts": { + "version": "4646078106-export function foo() { }", + "signature": "4646078106-export function foo() { }" + }, + "../b/src/bar/foo.ts": { + "version": "1045484683-export function bar() { }", + "signature": "1045484683-export function bar() { }" + }, + "./src/test.ts": { + "version": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n", + "signature": "14700910833-import { foo } from 'b/lib/foo';\nimport { bar } from 'b/lib/bar/foo';\nfoo();\nbar();\n" + } + }, + "options": { + "composite": true, + "outDir": "./lib", + "rootDir": "./src" + }, + "referencedMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "exportedModulesMap": { + "./src/test.ts": [ + "../b/src/foo.ts", + "../b/src/bar/foo.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "./src/test.ts", + "../b/src/bar/foo.ts", + "../b/src/foo.ts" + ] + }, + "version": "FakeTSVersion", + "size": 916 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project-when-solution-is-already-built.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project-when-solution-is-already-built.js new file mode 100644 index 0000000000000..9b343b81501e9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project-when-solution-is-already-built.js @@ -0,0 +1,345 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/user/username/projects/demo/tsconfig-base.json] +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true + } +} + +//// [/user/username/projects/demo/core/utilities.ts] + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + +//// [/user/username/projects/demo/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + } +} + +//// [/user/username/projects/demo/animals/animal.ts] +export type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/animals/dog.ts] +import Animal from '.'; +import { makeRandomName } from '../core/utilities'; + +export interface Dog extends Animal { + woof(): void; + name: string; +} + +export function createDog(): Dog { + return ({ + size: "medium", + woof: function(this: Dog) { + console.log(`${this.name} says "Woof"!`); + }, + name: makeRandomName() + }); +} + + + +//// [/user/username/projects/demo/animals/index.ts] +import Animal from './animal'; + +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/animals/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/animals", + "rootDir": ".", + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/demo/lib/core/utilities.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.lastElementOf = exports.makeRandomName = void 0; +function makeRandomName() { + return "Bob!?! "; +} +exports.makeRandomName = makeRandomName; +function lastElementOf(arr) { + if (arr.length === 0) + return undefined; + return arr[arr.length - 1]; +} +exports.lastElementOf = lastElementOf; + + +//// [/user/username/projects/demo/lib/core/utilities.d.ts] +export declare function makeRandomName(): string; +export declare function lastElementOf(arr: T[]): T | undefined; + + +//// [/user/username/projects/demo/lib/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../core/utilities.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"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"],"options":{"composite":true,"declaration":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../core","strict":true,"target":1},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2]},"version":"FakeTSVersion"} + +//// [/user/username/projects/demo/lib/animals/animal.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [/user/username/projects/demo/lib/animals/animal.d.ts] +export declare type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/lib/animals/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDog = void 0; +var dog_1 = require("./dog"); +Object.defineProperty(exports, "createDog", { enumerable: true, get: function () { return dog_1.createDog; } }); + + +//// [/user/username/projects/demo/lib/animals/index.d.ts] +import Animal from './animal'; +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/lib/animals/dog.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDog = void 0; +var utilities_1 = require("../core/utilities"); +function createDog() { + return ({ + size: "medium", + woof: function () { + console.log("".concat(this.name, " says \"Woof\"!")); + }, + name: (0, utilities_1.makeRandomName)() + }); +} +exports.createDog = createDog; + + +//// [/user/username/projects/demo/lib/animals/dog.d.ts] +import Animal from '.'; +export interface Dog extends Animal { + woof(): void; + name: string; +} +export declare function createDog(): Dog; + + +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../animals/animal.ts","../../animals/index.ts","../core/utilities.d.ts","../../animals/dog.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n","-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n","-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\n","-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"],"options":{"composite":true,"declaration":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../animals","strict":true,"target":1},"fileIdsList":[[3,4],[2,5]],"referencedMap":[[5,1],[3,2]],"exportedModulesMap":[[5,1],[3,2]],"semanticDiagnosticsPerFile":[1,2,5,3,4]},"version":"FakeTSVersion"} + + +/a/lib/tsc.js --w --p /user/username/projects/demo/animals/tsconfig.json +Output:: +>> Screen clear +[12:01:03 AM] Starting compilation in watch mode... + +[12:01:19 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/demo/animals/animal.ts","/user/username/projects/demo/animals/dog.ts","/user/username/projects/demo/animals/index.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/animals","rootDir":"/user/username/projects/demo/animals","configFilePath":"/user/username/projects/demo/animals/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts +/user/username/projects/demo/animals/dog.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts +/user/username/projects/demo/animals/dog.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/demo/core/utilities.ts (computed .d.ts) +/user/username/projects/demo/animals/dog.ts (computed .d.ts) +/user/username/projects/demo/animals/index.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/demo/animals/tsconfig.json: + {"fileName":"/user/username/projects/demo/animals/tsconfig.json","pollingInterval":250} +/user/username/projects/demo/core/tsconfig.json: + {"fileName":"/user/username/projects/demo/core/tsconfig.json","pollingInterval":250} +/user/username/projects/demo/tsconfig-base.json: + {"fileName":"/user/username/projects/demo/tsconfig-base.json","pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"fileName":"/user/username/projects/demo/animals/animal.ts","pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"fileName":"/user/username/projects/demo/animals/dog.ts","pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"fileName":"/user/username/projects/demo/animals/index.ts","pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"fileName":"/user/username/projects/demo/core/utilities.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/demo/animals/package.json: + {"fileName":"/user/username/projects/demo/animals/package.json","pollingInterval":250} + +FsWatches:: +/user/username/projects/demo/animals: + {"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/demo/core: + {"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals/node_modules/@types: + {"directoryName":"/user/username/projects/demo/animals/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/node_modules/@types: + {"directoryName":"/user/username/projects/demo/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals: + {"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/demo/lib/animals/index.js] file written with same contents +//// [/user/username/projects/demo/lib/animals/index.d.ts] file written with same contents +//// [/user/username/projects/demo/lib/animals/dog.js] file written with same contents +//// [/user/username/projects/demo/lib/animals/dog.d.ts] file written with same contents +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../animals/animal.ts","../../animals/index.ts","../../core/utilities.ts","../../animals/dog.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n",{"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":"1096904574-import Animal from './animal';\nexport default Animal;\nimport { createDog, Dog } from './dog';\nexport { createDog, Dog };\n"},{"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":"-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\n"},{"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":"6032048049-import Animal from '.';\nexport interface Dog extends Animal {\n woof(): void;\n name: string;\n}\nexport declare function createDog(): Dog;\n"}],"options":{"composite":true,"declaration":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../animals","strict":true,"target":1},"fileIdsList":[[3,4],[2,5],[3]],"referencedMap":[[5,1],[3,2]],"exportedModulesMap":[[5,3],[3,2]],"semanticDiagnosticsPerFile":[1,2,5,3,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/index.ts", + "../../core/utilities.ts", + "../../animals/dog.ts" + ], + "fileNamesList": [ + [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ], + [ + "../../animals/index.ts" + ] + ], + "fileInfos": { + "../../../../../../a/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; };", + "affectsGlobalScope": true + }, + "../../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": "-14984181202-export 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": "1096904574-import Animal from './animal';\nexport default Animal;\nimport { createDog, Dog } from './dog';\nexport { createDog, Dog };\n" + }, + "../../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": "-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\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": "6032048049-import Animal from '.';\nexport interface Dog extends Animal {\n woof(): void;\n name: string;\n}\nexport declare function createDog(): Dog;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "module": 1, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "./", + "rootDir": "../../animals", + "strict": true, + "target": 1 + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.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": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion", + "size": 2536 +} + diff --git a/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project.js b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project.js new file mode 100644 index 0000000000000..26455e87f7649 --- /dev/null +++ b/tests/baselines/reference/tscWatch/sourceOfProjectReferenceRedirect/with-simple-project.js @@ -0,0 +1,316 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/user/username/projects/demo/tsconfig-base.json] +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true + } +} + +//// [/user/username/projects/demo/core/utilities.ts] + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + +//// [/user/username/projects/demo/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + } +} + +//// [/user/username/projects/demo/animals/animal.ts] +export type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/animals/dog.ts] +import Animal from '.'; +import { makeRandomName } from '../core/utilities'; + +export interface Dog extends Animal { + woof(): void; + name: string; +} + +export function createDog(): Dog { + return ({ + size: "medium", + woof: function(this: Dog) { + console.log(`${this.name} says "Woof"!`); + }, + name: makeRandomName() + }); +} + + + +//// [/user/username/projects/demo/animals/index.ts] +import Animal from './animal'; + +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/animals/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/animals", + "rootDir": ".", + }, + "references": [ + { "path": "../core" } + ] +} + + + +/a/lib/tsc.js --w --p /user/username/projects/demo/animals/tsconfig.json +Output:: +>> Screen clear +[12:00:35 AM] Starting compilation in watch mode... + +[12:00:55 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/demo/animals/animal.ts","/user/username/projects/demo/animals/dog.ts","/user/username/projects/demo/animals/index.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/animals","rootDir":"/user/username/projects/demo/animals","configFilePath":"/user/username/projects/demo/animals/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts +/user/username/projects/demo/animals/dog.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts +/user/username/projects/demo/animals/dog.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/demo/animals/animal.ts (used version) +/user/username/projects/demo/animals/index.ts (used version) +/user/username/projects/demo/core/utilities.ts (used version) +/user/username/projects/demo/animals/dog.ts (used version) + +WatchedFiles:: +/user/username/projects/demo/animals/tsconfig.json: + {"fileName":"/user/username/projects/demo/animals/tsconfig.json","pollingInterval":250} +/user/username/projects/demo/core/tsconfig.json: + {"fileName":"/user/username/projects/demo/core/tsconfig.json","pollingInterval":250} +/user/username/projects/demo/tsconfig-base.json: + {"fileName":"/user/username/projects/demo/tsconfig-base.json","pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"fileName":"/user/username/projects/demo/animals/animal.ts","pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"fileName":"/user/username/projects/demo/animals/dog.ts","pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"fileName":"/user/username/projects/demo/animals/index.ts","pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"fileName":"/user/username/projects/demo/core/utilities.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/demo/animals/package.json: + {"fileName":"/user/username/projects/demo/animals/package.json","pollingInterval":250} + +FsWatches:: +/user/username/projects/demo/animals: + {"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/demo/core: + {"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals/node_modules/@types: + {"directoryName":"/user/username/projects/demo/animals/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/node_modules/@types: + {"directoryName":"/user/username/projects/demo/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals: + {"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/demo/lib/animals/animal.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [/user/username/projects/demo/lib/animals/animal.d.ts] +export declare type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/lib/animals/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDog = void 0; +var dog_1 = require("./dog"); +Object.defineProperty(exports, "createDog", { enumerable: true, get: function () { return dog_1.createDog; } }); + + +//// [/user/username/projects/demo/lib/animals/index.d.ts] +import Animal from './animal'; +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/lib/animals/dog.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDog = void 0; +var utilities_1 = require("../core/utilities"); +function createDog() { + return ({ + size: "medium", + woof: function () { + console.log("".concat(this.name, " says \"Woof\"!")); + }, + name: (0, utilities_1.makeRandomName)() + }); +} +exports.createDog = createDog; + + +//// [/user/username/projects/demo/lib/animals/dog.d.ts] +import Animal from '.'; +export interface Dog extends Animal { + woof(): void; + name: string; +} +export declare function createDog(): Dog; + + +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../../animals/animal.ts","../../animals/index.ts","../../core/utilities.ts","../../animals/dog.ts"],"fileInfos":[{"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; };","affectsGlobalScope":true},"-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n","-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n","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","-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"],"options":{"composite":true,"declaration":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../animals","strict":true,"target":1},"fileIdsList":[[3,4],[2,5]],"referencedMap":[[5,1],[3,2]],"exportedModulesMap":[[5,1],[3,2]],"semanticDiagnosticsPerFile":[1,2,5,3,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/index.ts", + "../../core/utilities.ts", + "../../animals/dog.ts" + ], + "fileNamesList": [ + [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + ], + "fileInfos": { + "../../../../../../a/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; };", + "affectsGlobalScope": true + }, + "../../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": "-14984181202-export 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": "-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n" + }, + "../../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": "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" + }, + "../../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": "-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" + } + }, + "options": { + "composite": true, + "declaration": true, + "module": 1, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "./", + "rootDir": "../../animals", + "strict": true, + "target": 1 + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion", + "size": 2024 +} + diff --git a/tests/baselines/reference/tscWatch/watchApi/extraFileExtensions-are-supported.js b/tests/baselines/reference/tscWatch/watchApi/extraFileExtensions-are-supported.js new file mode 100644 index 0000000000000..3cb760382f373 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/extraFileExtensions-are-supported.js @@ -0,0 +1,134 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/main.ts] +const x = 10; + +//// [/user/username/projects/myproject/other.vue] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:28 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.vue"] +Program options: {"allowNonTsExtensions":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.vue + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.vue + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.vue (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.vue: + {"fileName":"/user/username/projects/myproject/other.vue","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/main.js] +var x = 10; + + +//// [/user/username/projects/myproject/other.vue.js] + + + +Change:: Write a file + +Input:: +//// [/user/username/projects/myproject/other2.vue] + + + +Output:: +>> Screen clear +[12:00:31 AM] File change detected. Starting incremental compilation... + +[12:00:34 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.vue","/user/username/projects/myproject/other2.vue"] +Program options: {"allowNonTsExtensions":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.vue +/user/username/projects/myproject/other2.vue + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/other2.vue + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/other2.vue (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.vue: + {"fileName":"/user/username/projects/myproject/other.vue","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/other2.vue: + {"fileName":"/user/username/projects/myproject/other2.vue","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/other2.vue.js] + + diff --git a/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-emit-builder.js b/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-emit-builder.js new file mode 100644 index 0000000000000..fc6493f8707e7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-emit-builder.js @@ -0,0 +1,522 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"composite":true}} + +//// [/user/username/projects/myproject/main.ts] +export const x = 10; + +//// [/user/username/projects/myproject/other.ts] +export const y = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +tsc --w --noEmit +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:26 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-10726455937-export const x = 10;","-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-10726455937-export const x = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 742 +} + + +tsc --w +Output:: +>> Screen clear +[12:00:29 AM] Starting compilation in watch mode... + +[12:00:41 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-10726455937-export const x = 10;","-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-10726455937-export const x = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 701 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/main.d.ts] +export declare const x = 10; + + +//// [/user/username/projects/myproject/other.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 10; + + +//// [/user/username/projects/myproject/other.d.ts] +export declare const y = 10; + + + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; +// SomeComment + + +tsc --w --noEmit +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:51 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-14918944530-export const x = 10;\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"affectedFilesPendingEmit":[[2,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-14918944530-export const x = 10;\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 821 +} + + +tsc --w +Output:: +>> Screen clear +[12:00:55 AM] Starting compilation in watch mode... + +[12:01:05 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-14918944530-export const x = 10;\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-14918944530-export const x = 10;\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 786 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; +// SomeComment + + +//// [/user/username/projects/myproject/main.d.ts] file written with same contents + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; +// SomeComment +// SomeComment + + +tsc --w +Output:: +>> Screen clear +[12:01:11 AM] Starting compilation in watch mode... + +[12:01:21 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-16105752451-export const x = 10;\n// SomeComment\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-16105752451-export const x = 10;\n// SomeComment\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 802 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; +// SomeComment +// SomeComment + + +//// [/user/username/projects/myproject/main.d.ts] file written with same contents diff --git a/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-semantic-builder.js b/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-semantic-builder.js new file mode 100644 index 0000000000000..e3d303320d697 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/noEmit-with-composite-with-semantic-builder.js @@ -0,0 +1,559 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"composite":true}} + +//// [/user/username/projects/myproject/main.ts] +export const x = 10; + +//// [/user/username/projects/myproject/other.ts] +export const y = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +tsc --w --noEmit +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:26 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-10726455937-export const x = 10;","-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-10726455937-export const x = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 742 +} + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +tsc --w +Output:: +>> Screen clear +[12:00:29 AM] Starting compilation in watch mode... + +[12:00:41 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-10726455937-export const x = 10;","-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-10726455937-export const x = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 701 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/main.d.ts] +export declare const x = 10; + + +//// [/user/username/projects/myproject/other.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 10; + + +//// [/user/username/projects/myproject/other.d.ts] +export declare const y = 10; + + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; +// SomeComment + + +tsc --w --noEmit +Output:: +>> Screen clear +[12:00:47 AM] Starting compilation in watch mode... + +[12:00:51 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-14918944530-export const x = 10;\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"affectedFilesPendingEmit":[[2,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-14918944530-export const x = 10;\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 821 +} + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +tsc --w +Output:: +>> Screen clear +[12:00:55 AM] Starting compilation in watch mode... + +[12:01:05 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-14918944530-export const x = 10;\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-14918944530-export const x = 10;\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 786 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; +// SomeComment + + +//// [/user/username/projects/myproject/main.d.ts] file written with same contents + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; +// SomeComment +// SomeComment + + +tsc --w +Output:: +>> Screen clear +[12:01:11 AM] Starting compilation in watch mode... + +[12:01:27 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-16105752451-export const x = 10;\n// SomeComment\n// SomeComment","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-16105752451-export const x = 10;\n// SomeComment\n// SomeComment", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 802 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; +// SomeComment +// SomeComment + + +//// [/user/username/projects/myproject/main.d.ts] file written with same contents +//// [/user/username/projects/myproject/other.js] file written with same contents +//// [/user/username/projects/myproject/other.d.ts] file written with same contents + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true diff --git a/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-emit-builder.js b/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-emit-builder.js new file mode 100644 index 0000000000000..746f207f20c77 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-emit-builder.js @@ -0,0 +1,376 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"composite":true,"noEmitOnError":true}} + +//// [/user/username/projects/myproject/main.ts] +export const x: string = 10; + +//// [/user/username/projects/myproject/other.ts] +export const y = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +tsc --w +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +user/username/projects/myproject/main.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. + +1 export const x: string = 10; +   ~ + +[12:00:26 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-8089124208-export const x: string = 10;","-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./main.ts","start":13,"length":1,"code":2322,"category":1,"messageText":"Type 'number' is not assignable to type 'string'."}]],3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-8089124208-export const x: string = 10;", + "signature": "-8089124208-export const x: string = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./main.ts", + [ + { + "file": "./main.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 908 +} + + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x: string = 10; +// SomeComment + + +tsc --w +Output:: +>> Screen clear +[12:00:31 AM] Starting compilation in watch mode... + +user/username/projects/myproject/main.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. + +1 export const x: string = 10; +   ~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-5691975201-export const x: string = 10;\n// SomeComment","signature":"-10161843860-export declare const x: string;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./main.ts","start":13,"length":1,"code":2322,"category":1,"messageText":"Type 'number' is not assignable to type 'string'."}]],3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-5691975201-export const x: string = 10;\n// SomeComment", + "signature": "-10161843860-export declare const x: string;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./main.ts", + [ + { + "file": "./main.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 997 +} + + +Change:: Fix error + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; + + +tsc --w +Output:: +>> Screen clear +[12:00:42 AM] Starting compilation in watch mode... + +[12:00:54 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-10726455937-export const x = 10;","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ] + }, + "version": "FakeTSVersion", + "size": 791 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/main.d.ts] +export declare const x = 10; + + +//// [/user/username/projects/myproject/other.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 10; + + +//// [/user/username/projects/myproject/other.d.ts] +export declare const y = 10; + + diff --git a/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-semantic-builder.js b/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-semantic-builder.js new file mode 100644 index 0000000000000..346791714ee68 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/noEmitOnError-with-composite-with-semantic-builder.js @@ -0,0 +1,407 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"composite":true,"noEmitOnError":true}} + +//// [/user/username/projects/myproject/main.ts] +export const x: string = 10; + +//// [/user/username/projects/myproject/other.ts] +export const y = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +tsc --w +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +user/username/projects/myproject/main.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. + +1 export const x: string = 10; +   ~ + +[12:00:26 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},"-8089124208-export const x: string = 10;","-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./main.ts","start":13,"length":1,"code":2322,"category":1,"messageText":"Type 'number' is not assignable to type 'string'."}]],3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-8089124208-export const x: string = 10;", + "signature": "-8089124208-export const x: string = 10;" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./main.ts", + [ + { + "file": "./main.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 908 +} + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +Change:: Add comment + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x: string = 10; +// SomeComment + + +tsc --w +Output:: +>> Screen clear +[12:00:31 AM] Starting compilation in watch mode... + +user/username/projects/myproject/main.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. + +1 export const x: string = 10; +   ~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-5691975201-export const x: string = 10;\n// SomeComment","signature":"-10161843860-export declare const x: string;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./main.ts","start":13,"length":1,"code":2322,"category":1,"messageText":"Type 'number' is not assignable to type 'string'."}]],3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-5691975201-export const x: string = 10;\n// SomeComment", + "signature": "-10161843860-export declare const x: string;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + [ + "./main.ts", + [ + { + "file": "./main.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 997 +} + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: true + +Change:: Fix error + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; + + +tsc --w +Output:: +>> Screen clear +[12:00:42 AM] Starting compilation in watch mode... + +[12:00:54 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"composite":true,"noEmitOnError":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./main.ts","./other.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-10726455937-export const x = 10;","signature":"-6821242887-export declare const x = 10;\n"},"-13729955264-export const y = 10;"],"options":{"composite":true,"noEmitOnError":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "./main.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./other.ts": { + "version": "-13729955264-export const y = 10;", + "signature": "-13729955264-export const y = 10;" + } + }, + "options": { + "composite": true, + "noEmitOnError": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./main.ts", + "./other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "./main.ts", + "Full" + ], + [ + "./other.ts", + "Full" + ] + ] + }, + "version": "FakeTSVersion", + "size": 832 +} + +//// [/user/username/projects/myproject/main.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/main.d.ts] +export declare const x = 10; + + +//// [/user/username/projects/myproject/other.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 10; + + +//// [/user/username/projects/myproject/other.d.ts] +export declare const y = 10; + + + +Checking if output is same as EmitAndSemanticDiagnosticsBuilderProgram:: +Output file text for /user/username/projects/myproject/main.js is same:: true +Output file text for /user/username/projects/myproject/main.d.ts is same:: true +Output file text for /user/username/projects/myproject/other.js is same:: true +Output file text for /user/username/projects/myproject/other.d.ts is same:: true +Output file text for /user/username/projects/myproject/tsconfig.tsbuildinfo is same:: false diff --git a/tests/baselines/reference/tscWatch/watchApi/verifies-that-noEmit-is-handled-on-createSemanticDiagnosticsBuilderProgram.js b/tests/baselines/reference/tscWatch/watchApi/verifies-that-noEmit-is-handled-on-createSemanticDiagnosticsBuilderProgram.js new file mode 100644 index 0000000000000..93e8cdd0f6c6d --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/verifies-that-noEmit-is-handled-on-createSemanticDiagnosticsBuilderProgram.js @@ -0,0 +1,122 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/main.ts] +export const x = 10; + +//// [/user/username/projects/myproject/other.ts] +export const y = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:24 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) +/user/username/projects/myproject/other.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + + +Change:: Modify a file + +Input:: +//// [/user/username/projects/myproject/main.ts] +export const x = 10; +// SomeComment + + +Output:: +>> Screen clear +[12:00:27 AM] File change detected. Starting incremental compilation... + +[12:00:28 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts","/user/username/projects/myproject/other.ts"] +Program options: {"noEmit":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts +/user/username/projects/myproject/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/user/username/projects/myproject/other.ts: + {"fileName":"/user/username/projects/myproject/other.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js b/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js new file mode 100644 index 0000000000000..b569dd310d3f1 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js @@ -0,0 +1,84 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/index.ts] +import settings from './settings.json'; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"module":"commonjs","resolveJsonModule":true},"files":["index.ts"]} + +//// [/user/username/projects/myproject/settings.json] +{"content":"Print this"} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear +[12:00:23 AM] Starting compilation in watch mode... + +index.ts:1:8 - error TS1259: Module '"/user/username/projects/myproject/settings"' can only be default-imported using the 'esModuleInterop' flag + +1 import settings from './settings.json'; +   ~~~~~~~~ + + settings.json:1:1 + 1 {"content":"Print this"} +   ~ + This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. + +[12:00:26 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/index.ts"] +Program options: {"module":1,"resolveJsonModule":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/settings.json +/user/username/projects/myproject/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/settings.json +/user/username/projects/myproject/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/settings.json (used version) +/user/username/projects/myproject/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/index.ts: + {"fileName":"/user/username/projects/myproject/index.ts","pollingInterval":250} +/user/username/projects/myproject/settings.json: + {"fileName":"/user/username/projects/myproject/settings.json","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/index.js] +"use strict"; +exports.__esModule = true; + + diff --git a/tests/baselines/reference/tscWatch/watchApi/verify-that-the-error-count-is-correctly-passed-down-to-the-watch-status-reporter.js b/tests/baselines/reference/tscWatch/watchApi/verify-that-the-error-count-is-correctly-passed-down-to-the-watch-status-reporter.js new file mode 100644 index 0000000000000..17f91edc17505 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/verify-that-the-error-count-is-correctly-passed-down-to-the-watch-status-reporter.js @@ -0,0 +1,81 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/index.ts] +let compiler = new Compiler(); for (let i = 0; j < 5; i++) {} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"module":"commonjs"},"files":["index.ts"]} + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear +[12:00:21 AM] Starting compilation in watch mode... + +index.ts:1:20 - error TS2552: Cannot find name 'Compiler'. Did you mean 'compiler'? + +1 let compiler = new Compiler(); for (let i = 0; j < 5; i++) {} +   ~~~~~~~~ + + index.ts:1:5 + 1 let compiler = new Compiler(); for (let i = 0; j < 5; i++) {} +    ~~~~~~~~ + 'compiler' is declared here. + +index.ts:1:48 - error TS2304: Cannot find name 'j'. + +1 let compiler = new Compiler(); for (let i = 0; j < 5; i++) {} +   ~ + +[12:00:24 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/index.ts"] +Program options: {"module":1,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/index.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/index.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/index.ts: + {"fileName":"/user/username/projects/myproject/index.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/index.js] +var compiler = new Compiler(); +for (var i = 0; j < 5; i++) { } + + diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js index 9a42287a007e2..9ec37ab2c3928 100644 --- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js +++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js @@ -30,8 +30,7 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --w -p /user/username/projects/myproject/projects/project2/tsconfig.json --extendedDiagnostics Output:: - -12:00:33 AM - Starting compilation in watch mode... +[12:00:33 AM] Starting compilation in watch mode... Current directory: / CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2/tsconfig.json 2000 undefined Config file @@ -53,8 +52,8 @@ DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/node_modules/@types 1 undefined Type roots DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots +[12:00:40 AM] Found 0 errors. Watching for file changes. -12:00:40 AM - Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2 1 undefined Wild card directory @@ -121,6 +120,45 @@ declare class class2 { //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.d.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-3469237238-declare class class1 {}","affectsGlobalScope":true},{"version":"777969115-class class2 {}","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.d.ts": { + "version": "-3469237238-declare class class1 {}", + "signature": "-3469237238-declare class class1 {}", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "777969115-class class2 {}", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "./class2.ts" + ] + }, + "version": "FakeTSVersion", + "size": 760 +} + Change:: Add class3 to project1 @@ -135,19 +173,24 @@ Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project Synchronizing program Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json - -12:00:43 AM - File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: roots: ["/user/username/projects/myproject/projects/project2/class2.ts"] options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"} projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file -error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found. +error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found. The file is in the program because: Output from referenced project '/user/username/projects/myproject/projects/project1/tsconfig.json' included because '--module' is specified as 'none' -12:00:44 AM - Found 1 error. Watching for file changes. + user/username/projects/myproject/projects/project2/tsconfig.json:1:69 + 1 {"compilerOptions":{"module":"none","composite":true},"references":[{"path":"../project1"}]} +    ~~~~~~~~~~~~~~~~~~~~~~ + File is output from referenced project specified here. + +[12:00:46 AM] Found 1 error. Watching for file changes. + Program root files: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -209,16 +252,15 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project Synchronizing program - -12:00:47 AM - File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: roots: ["/user/username/projects/myproject/projects/project2/class2.ts"] options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"} projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file +[12:00:59 AM] Found 0 errors. Watching for file changes. -12:00:57 AM - Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -276,6 +318,52 @@ exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.d.ts","../project1/class3.d.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-3469237238-declare class class1 {}","affectsGlobalScope":true},{"version":"-3469165364-declare class class3 {}","affectsGlobalScope":true},{"version":"777969115-class class2 {}","signature":"-2684084705-declare class class2 {\n}\n","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "../project1/class3.d.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.d.ts": { + "version": "-3469237238-declare class class1 {}", + "signature": "-3469237238-declare class class1 {}", + "affectsGlobalScope": true + }, + "../project1/class3.d.ts": { + "version": "-3469165364-declare class class3 {}", + "signature": "-3469165364-declare class class3 {}", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "-2684084705-declare class class2 {\n}\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "../project1/class3.d.ts", + "./class2.ts" + ] + }, + "version": "FakeTSVersion", + "size": 918 +} + Change:: Add excluded file to project1 @@ -293,10 +381,6 @@ Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detec Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/temp/file.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project -Program: Same as old program - -BuilderProgram: Same as old builder program - WatchedFiles:: /user/username/projects/myproject/projects/project2/tsconfig.json: {"fileName":"/user/username/projects/myproject/projects/project2/tsconfig.json","pollingInterval":250} @@ -341,8 +425,7 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project Synchronizing program - -12:01:03 AM - File change detected. Starting incremental compilation... +[12:01:08 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: roots: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -350,11 +433,17 @@ CreatingProgramWith:: projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file -error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found. +error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found. The file is in the program because: Output from referenced project '/user/username/projects/myproject/projects/project1/tsconfig.json' included because '--module' is specified as 'none' -12:01:13 AM - Found 1 error. Watching for file changes. + user/username/projects/myproject/projects/project2/tsconfig.json:1:69 + 1 {"compilerOptions":{"module":"none","composite":true},"references":[{"path":"../project1"}]} +    ~~~~~~~~~~~~~~~~~~~~~~ + File is output from referenced project specified here. + +[12:01:18 AM] Found 1 error. Watching for file changes. + Program root files: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -408,6 +497,43 @@ exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.d.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-3469237238-declare class class1 {}","affectsGlobalScope":true},{"version":"777969115-class class2 {}","signature":"-2684084705-declare class class2 {\n}\n","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.d.ts": { + "version": "-3469237238-declare class class1 {}", + "signature": "-3469237238-declare class class1 {}", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "-2684084705-declare class class2 {\n}\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts" + ] + }, + "version": "FakeTSVersion", + "size": 810 +} + Change:: Add output of class3 @@ -425,16 +551,15 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project Synchronizing program - -12:01:16 AM - File change detected. Starting incremental compilation... +[12:01:24 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: roots: ["/user/username/projects/myproject/projects/project2/class2.ts"] options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"} projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file +[12:01:34 AM] Found 0 errors. Watching for file changes. -12:01:26 AM - Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -492,3 +617,49 @@ exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.d.ts","../project1/class3.d.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"-3469237238-declare class class1 {}","affectsGlobalScope":true},{"version":"-3469165364-declare class class3 {}","affectsGlobalScope":true},{"version":"777969115-class class2 {}","signature":"-2684084705-declare class class2 {\n}\n","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "../project1/class3.d.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.d.ts": { + "version": "-3469237238-declare class class1 {}", + "signature": "-3469237238-declare class class1 {}", + "affectsGlobalScope": true + }, + "../project1/class3.d.ts": { + "version": "-3469165364-declare class class3 {}", + "signature": "-3469165364-declare class class3 {}", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "-2684084705-declare class class2 {\n}\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.d.ts", + "../project1/class3.d.ts", + "./class2.ts" + ] + }, + "version": "FakeTSVersion", + "size": 918 +} + diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js index ae46872cf8043..6593e9d8cf2bf 100644 --- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js +++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js @@ -30,8 +30,7 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --w -p /user/username/projects/myproject/projects/project2/tsconfig.json --extendedDiagnostics Output:: - -12:00:33 AM - Starting compilation in watch mode... +[12:00:33 AM] Starting compilation in watch mode... Current directory: / CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2/tsconfig.json 2000 undefined Config file @@ -53,8 +52,8 @@ DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/node_modules/@types 1 undefined Type roots DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots +[12:00:40 AM] Found 0 errors. Watching for file changes. -12:00:40 AM - Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project2 1 undefined Wild card directory @@ -121,6 +120,45 @@ declare class class2 { //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"777933178-class class1 {}","affectsGlobalScope":true},{"version":"777969115-class class2 {}","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.ts": { + "version": "777933178-class class1 {}", + "signature": "777933178-class class1 {}", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "777969115-class class2 {}", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.ts", + "./class2.ts" + ] + }, + "version": "FakeTSVersion", + "size": 748 +} + Change:: Add class3 to project1 @@ -135,16 +173,15 @@ Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project Synchronizing program Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json - -12:00:43 AM - File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: roots: ["/user/username/projects/myproject/projects/project2/class2.ts"] options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"} projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.ts 250 undefined Source file +[12:00:55 AM] Found 0 errors. Watching for file changes. -12:00:53 AM - Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/projects/project2/class2.ts"] @@ -202,6 +239,52 @@ exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo] {"program":{"fileNames":["../../../../../../a/lib/lib.d.ts","../project1/class1.ts","../project1/class3.ts","./class2.ts"],"fileInfos":[{"version":"-7698705165-/// \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; }","affectsGlobalScope":true},{"version":"777933178-class class1 {}","signature":"-2723220098-declare class class1 {\n}\n","affectsGlobalScope":true},{"version":"778005052-class class3 {}","signature":"-2644949312-declare class class3 {\n}\n","affectsGlobalScope":true},{"version":"777969115-class class2 {}","signature":"-2684084705-declare class class2 {\n}\n","affectsGlobalScope":true}],"options":{"composite":true,"module":0},"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} +//// [/user/username/projects/myproject/projects/project2/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.ts", + "../project1/class3.ts", + "./class2.ts" + ], + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \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; }", + "signature": "-7698705165-/// \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; }", + "affectsGlobalScope": true + }, + "../project1/class1.ts": { + "version": "777933178-class class1 {}", + "signature": "-2723220098-declare class class1 {\n}\n", + "affectsGlobalScope": true + }, + "../project1/class3.ts": { + "version": "778005052-class class3 {}", + "signature": "-2644949312-declare class class3 {\n}\n", + "affectsGlobalScope": true + }, + "./class2.ts": { + "version": "777969115-class class2 {}", + "signature": "-2684084705-declare class class2 {\n}\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "module": 0 + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../project1/class1.ts", + "../project1/class3.ts", + "./class2.ts" + ] + }, + "version": "FakeTSVersion", + "size": 1002 +} + Change:: Add excluded file to project1 @@ -219,10 +302,6 @@ Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detec Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/temp/file.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project -Program: Same as old program - -BuilderProgram: Same as old builder program - WatchedFiles:: /user/username/projects/myproject/projects/project2/tsconfig.json: {"fileName":"/user/username/projects/myproject/projects/project2/tsconfig.json","pollingInterval":250} @@ -267,10 +346,6 @@ Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detec Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project -Program: Same as old program - -BuilderProgram: Same as old builder program - WatchedFiles:: /user/username/projects/myproject/projects/project2/tsconfig.json: {"fileName":"/user/username/projects/myproject/projects/project2/tsconfig.json","pollingInterval":250} diff --git a/tests/baselines/reference/tscWatch/watchApi/without-timesouts-on-host-program-gets-updated.js b/tests/baselines/reference/tscWatch/watchApi/without-timesouts-on-host-program-gets-updated.js new file mode 100644 index 0000000000000..ff7be3bc4966c --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchApi/without-timesouts-on-host-program-gets-updated.js @@ -0,0 +1,122 @@ +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/main.ts] +const x = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +Output:: +>> Screen clear +[12:00:21 AM] Starting compilation in watch mode... + +[12:00:24 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/main.ts"] +Program options: {"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/main.ts (used version) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/main.js] +var x = 10; + + + +Change:: Write a file + +Input:: +//// [/user/username/projects/myproject/bar.ts] +const y =10; + + +Output:: +[12:00:32 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/bar.ts","/user/username/projects/myproject/main.ts"] +Program options: {"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/bar.ts +/user/username/projects/myproject/main.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/bar.ts +/user/username/projects/myproject/main.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/bar.ts (computed .d.ts) +/user/username/projects/myproject/main.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/main.ts: + {"fileName":"/user/username/projects/myproject/main.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/bar.ts: + {"fileName":"/user/username/projects/myproject/bar.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/main.js] file written with same contents +//// [/user/username/projects/myproject/bar.js] +var y = 10; + + From 8d7151a7e998abec93e136256816066bf608e235 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 29 Mar 2022 10:58:24 -0700 Subject: [PATCH 2/3] Set modified time in baseline --- src/harness/vfsUtil.ts | 15 ++++++++++++++- .../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 ++ .../stripInternal.js | 2 ++ .../triple-slash-refs-in-all-projects.js | 2 ++ .../multiple-emitHelpers-in-all-projects.js | 2 ++ .../multiple-prologues-in-all-projects.js | 1 + ...js-projects-and-concatenates-them-correctly.js | 1 + .../baseline-sectioned-sourcemaps.js | 2 ++ .../emitHelpers-in-all-projects.js | 2 ++ .../emitHelpers-in-only-one-dependency-project.js | 2 ++ .../explainFiles.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 ++ ...t-when-one-two-three-are-prepended-in-order.js | 4 ++++ .../stripInternal-jsdoc-style-comment.js | 2 ++ ...d-when-one-two-three-are-prepended-in-order.js | 4 ++++ ...rnal-jsdoc-style-with-comments-emit-enabled.js | 2 ++ ...l-when-one-two-three-are-prepended-in-order.js | 4 ++++ ...d-when-one-two-three-are-prepended-in-order.js | 4 ++++ .../stripInternal-with-comments-emit-enabled.js | 2 ++ .../stripInternal.js | 2 ++ .../triple-slash-refs-in-all-projects.js | 2 ++ .../triple-slash-refs-in-one-project.js | 2 ++ ...when-source-files-are-empty-in-the-own-file.js | 2 ++ .../emitHelpers-in-all-projects.js | 1 + .../emitHelpers-in-only-one-dependency-project.js | 1 + .../multiple-emitHelpers-in-all-projects.js | 1 + .../multiple-emitHelpers-in-different-projects.js | 1 + .../multiple-prologues-in-all-projects.js | 1 + .../multiple-prologues-in-different-projects.js | 1 + .../strict-in-all-projects.js | 1 + .../strict-in-one-dependency.js | 1 + ...t-when-one-two-three-are-prepended-in-order.js | 5 +++++ .../stripInternal-jsdoc-style-comment.js | 2 ++ ...l-when-one-two-three-are-prepended-in-order.js | 5 +++++ ...d-when-one-two-three-are-prepended-in-order.js | 5 +++++ .../stripInternal-with-comments-emit-enabled.js | 2 ++ .../stripInternal.js | 2 ++ ...ects-type-only-changes-in-upstream-projects.js | 2 ++ .../tsbuild/sample1/initial-build/explainFiles.js | 3 +++ .../sample1/initial-build/listEmittedFiles.js | 3 +++ .../tsbuild/sample1/initial-build/listFiles.js | 3 +++ .../tsbuild/sample1/initial-build/sample.js | 5 +++++ 52 files changed, 129 insertions(+), 1 deletion(-) diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 5eca1ce30bb02..b32bb78568322 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -809,7 +809,11 @@ namespace vfs { const baseBuffer = base._getBuffer(baseNode); // no difference if both buffers are the same reference - if (changedBuffer === baseBuffer) return false; + if (changedBuffer === baseBuffer) { + if (!options.includeChangedFileWithSameContent || changedNode.mtimeMs === baseNode.mtimeMs) return false; + container[basename] = new SameFileWithModifiedTime(changedBuffer); + return true; + } // no difference if both buffers are identical if (Buffer.compare(changedBuffer, baseBuffer) === 0) { @@ -1391,6 +1395,12 @@ namespace vfs { } } + export class SameFileWithModifiedTime extends File { + constructor(data: Buffer | string, metaAndEncoding?: { encoding?: string, meta?: Record }) { + super(data, metaAndEncoding); + } + } + /** Extended options for a hard link in a `FileSet` */ export class Link { public readonly path: string; @@ -1579,6 +1589,9 @@ namespace vfs { else if (entry instanceof Directory) { text += formatPatchWorker(file, entry.files); } + else if (entry instanceof SameFileWithModifiedTime) { + text += `//// [${file}] file changed its modified time\r\n`; + } else if (entry instanceof SameFileContentFile) { text += `//// [${file}] file written with same contents\r\n`; } 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 d53ecc01ec1b1..cb0aa4b1d9176 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 @@ -23,6 +23,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { 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 d7c110e87956a..9fa2c58aa0da9 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 @@ -25,6 +25,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; 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 c87c85bcc6561..a6e46ad3b26ef 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 @@ -23,6 +23,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] "use strict"; "myPrologue"; 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 1895fb9214a6f..3ee131ba99ba1 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 @@ -24,6 +24,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] #!someshebang lib file0 var myGlob = 20; 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 fb0a44924d21a..a6ed40e8ad415 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 @@ -48,6 +48,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] /*@internal*/ var myGlob = 20; define("file1", ["require", "exports"], function (require, exports) { 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 f91e446920176..ee8e6f2e52975 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 @@ -23,6 +23,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] /// var file0Const = new libfile0(); 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 2aaecf03220da..9efcdbfe6a6d4 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 @@ -23,6 +23,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time +//// [/src/app/module.d.ts.map] file changed its modified time //// [/src/app/module.js] var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; 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 a9c47a41dc634..bb509d4a8020c 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 @@ -24,6 +24,7 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/app/module.d.ts] file changed its modified time //// [/src/app/module.d.ts.map] {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"} 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 05712ab096cea..26dcebdc0412f 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 @@ -590,6 +590,7 @@ type MyNominal = Nominal; "size": 425 } +//// [/src/sub-project-2/sub-project-2.d.ts] file changed its modified time //// [/src/sub-project-2/sub-project-2.js] /** * @template T, Name 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 c06e17f7a0752..e900aa02e907a 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 @@ -311,6 +311,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 4cd5a76ecb307..4dc7ffdf5de0e 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 @@ -466,6 +466,8 @@ declare function f(): string; "size": 362 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; 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 b6512e12e6123..74915ef414946 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 @@ -309,6 +309,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js index 714420ba8916a..16c329aa01075 100644 --- a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js @@ -297,6 +297,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 7fc98e8d54e0c..db08d7ac949e7 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 @@ -672,6 +672,8 @@ declare const firstfirst_part3_ar: number[]; "size": 553 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; 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 c413c5fec5afd..5fa2125d2c2dd 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 @@ -444,6 +444,8 @@ declare function f(): string; "size": 362 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var __rest = (this && this.__rest) || function (s, e) { var t = {}; 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 15f949a8f29a8..3fbb89cd8fe56 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 @@ -374,6 +374,8 @@ declare function f(): string; "size": 588 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] "use strict"; "myPrologue"; 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 918002702eeb0..0a8e609a068f4 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 @@ -319,6 +319,8 @@ declare function f(): string; "size": 445 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] "use strict"; "myPrologue"; 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 12e2c49cd4195..cef07103d910e 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 @@ -316,6 +316,8 @@ declare function f(): string; "size": 254 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] #!someshebang first first_PART1 var s = "Hello, world"; 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 77af303696590..5e5bb15e8a948 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 @@ -289,6 +289,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] #!someshebang second second_part1 var s = "Hello, world"; 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 6b057aa8b846d..4c0669455297d 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 @@ -341,6 +341,8 @@ declare function f(): string; "size": 445 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] "use strict"; var s = "Hello, world"; 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 f23cae890a148..1d83da04c29d0 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 @@ -289,6 +289,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] "use strict"; var s = "Hello, world"; 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 333d23f42ea1d..deb10ce3b2d84 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 @@ -41,6 +41,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/2/second-output.d.ts] file changed its modified time +//// [/src/2/second-output.d.ts.map] file changed its modified time //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2331,6 +2333,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 f49845a6a9978..21a1fbe160ea2 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 @@ -296,6 +296,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 177a9ef3251df..3ddf904adc1a1 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 @@ -41,6 +41,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/2/second-output.d.ts] file changed its modified time +//// [/src/2/second-output.d.ts.map] file changed its modified time //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2431,6 +2433,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 42fd7414c7f72..a2828f6a2dfa7 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 @@ -296,6 +296,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 7e6abf689e82b..d787e6f76b2c9 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 @@ -63,6 +63,8 @@ readFiles:: { "/src/third/thirdjs/output/third-output.d.ts.map": 1 } +//// [/src/2/second-output.d.ts] file changed its modified time +//// [/src/2/second-output.d.ts.map] file changed its modified time //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2353,6 +2355,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 f8cbfaf94e158..af54aaa7e38dd 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 @@ -41,6 +41,8 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/2/second-output.d.ts] file changed its modified time +//// [/src/2/second-output.d.ts.map] file changed its modified time //// [/src/2/second-output.js] var s = "Hello, world"; console.log(s); @@ -2431,6 +2433,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 02ebc6814833a..78a9de3c1c128 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 @@ -296,6 +296,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 219fb1ec60d4c..b5e94f4f2df13 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 @@ -318,6 +318,8 @@ declare function f(): string; "size": 290 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 57cf4ef9378ea..e73ba55f9469c 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 @@ -352,6 +352,8 @@ declare function f(): string; "size": 318 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 730604fbfb30e..3e416335558a1 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 @@ -289,6 +289,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 ab9b3c0102849..5483f7c0f450e 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 @@ -289,6 +289,8 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time +//// [/src/third/thirdjs/output/third-output.d.ts.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.js] var s = "Hello, world"; console.log(s); 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 bc777f73eb415..07aa76cbfccfa 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 @@ -450,6 +450,7 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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;AAGD,iBAAS,uBAAuB,SAAM;ACXtC,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AACD,iBAAS,yBAAyB,SAEjC;ACbD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC;AAEhB,iBAAS,uBAAuB,SAE/B"} 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 c326a9b0e1db1..eef90697523f0 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 @@ -565,6 +565,7 @@ declare function f(): string; "size": 362 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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;AAGD,iBAAS,uBAAuB,SAE/B;ACbD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AACD,iBAAS,yBAAyB,SAEjC;ACbD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} 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 27902110bba72..d83b7db5bea3e 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 @@ -711,6 +711,7 @@ declare const firstfirst_part3_ar: number[]; "size": 463 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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;AAGD,iBAAS,uBAAuB,SAAM;ACXtC,iBAAS,CAAC,WAET;AACD,iBAAS,sBAAsB,CAAC,GAAG,GAAG,MAAM,EAAE,QAAK;AACnD,QAAA,MAAM,mBAAmB,UAAW,CAAC;ACJrC,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AACD,iBAAS,yBAAyB,SAEjC;ACbD,cAAM,CAAC;IACH,WAAW;CAGd;AAED,iBAAS,wBAAwB,CAAC,GAAG,GAAG,MAAM,EAAE,QAAK;AACrD,QAAA,MAAM,qBAAqB,UAAW,CAAC;ACPvC,QAAA,IAAI,CAAC,GAAU,CAAC;AAEhB,iBAAS,uBAAuB,SAE/B;AACD,iBAAS,sBAAsB,CAAC,GAAG,GAAG,MAAM,EAAE,QAAK;AACnD,QAAA,MAAM,mBAAmB,UAAW,CAAC"} 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 9c81d821c2a90..68235b642a216 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 @@ -428,6 +428,7 @@ declare function f(): string; "size": 252 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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;AAGD,iBAAS,uBAAuB,SAAM;ACXtC,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;AAED,iBAAS,wBAAwB,CAAC,GAAG,GAAG,MAAM,EAAE,QAAK;AACrD,QAAA,MAAM,qBAAqB,UAAW,CAAC;ACbvC,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC;AAEhB,iBAAS,uBAAuB,SAE/B"} 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 ecdd188983f88..da5de57663296 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 @@ -509,6 +509,7 @@ declare function f(): string; "size": 738 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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":"AAEA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACVD,iBAAS,CAAC,WAET;ACDD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd;ACHD,QAAA,IAAI,CAAC,GAAU,CAAC"} 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 ace05780b48d5..98a68fde5c31e 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 @@ -454,6 +454,7 @@ declare function f(): string; "size": 591 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACTD,iBAAS,CAAC,WAET;ACDD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd;ACLD,QAAA,IAAI,CAAC,GAAU,CAAC"} 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 f0a09d38ebd97..2817ea715a220 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 @@ -476,6 +476,7 @@ declare function f(): string; "size": 588 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACTD,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"} 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 d6e713b71ea61..19b20a01ae93f 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 @@ -434,6 +434,7 @@ declare function f(): string; "size": 457 } +//// [/src/third/thirdjs/output/third-output.d.ts] file changed its modified time //// [/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":"AACA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACTD,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"} 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 a601ee662ddf0..b110160120f7c 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 @@ -41,6 +41,7 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/2/second-output.d.ts] file changed its modified time //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.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;AAED,cAAM,OAAO;;IAEM,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;IACN,IAAI,CAAC,IACM,MAAM,CADK;IACtB,IAAI,CAAC,CAAC,KAAK,MAAM,EAAK;CACxC;AACD,kBAAU,OAAO,CAAC;IACC,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACtD;AACc,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC5C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -852,6 +853,8 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map +//// [/src/2/second-output.js] file changed its modified time +//// [/src/2/second-output.js.map] file changed its modified time //// [/src/2/second-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../second","sourceFiles":["../second/second_part1.ts","../second/second_part2.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3163,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":234,"kind":"text"},{"pos":234,"end":339,"kind":"internal"},{"pos":341,"end":373,"kind":"text"},{"pos":373,"end":765,"kind":"internal"},{"pos":767,"end":770,"kind":"text"},{"pos":770,"end":1183,"kind":"internal"},{"pos":1185,"end":1233,"kind":"text"}]}},"version":"FakeTSVersion"} @@ -1817,6 +1820,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":3163,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":0,"end":3163,"kind":"text"}]},{"pos":3163,"end":3199,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":0,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 dbef136e8381c..c435bb7188009 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 @@ -703,6 +703,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3163,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":3163,"kind":"text"}]},{"pos":3163,"end":3199,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 f279711d20a42..d0c3fefd8d0d1 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 @@ -63,6 +63,7 @@ readFiles:: { "/src/third/thirdjs/output/third-output.d.ts.map": 1 } +//// [/src/2/second-output.d.ts] file changed its modified time //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.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;AAED,cAAM,OAAO;;IAEK,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;IACN,IAAI,CAAC,IACM,MAAM,CADK;IACtB,IAAI,CAAC,CAAC,KAAK,MAAM,EAAK;CACvC;AACD,kBAAU,OAAO,CAAC;IACA,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACrD;AACa,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC3C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -874,6 +875,8 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map +//// [/src/2/second-output.js] file changed its modified time +//// [/src/2/second-output.js.map] file changed its modified time //// [/src/2/second-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../second","sourceFiles":["../second/second_part1.ts","../second/second_part2.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3163,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":234,"kind":"text"},{"pos":234,"end":339,"kind":"internal"},{"pos":341,"end":373,"kind":"text"},{"pos":373,"end":765,"kind":"internal"},{"pos":767,"end":770,"kind":"text"},{"pos":770,"end":1183,"kind":"internal"},{"pos":1185,"end":1233,"kind":"text"}]}},"version":"FakeTSVersion"} @@ -1839,6 +1842,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":3163,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":0,"end":3163,"kind":"text"}]},{"pos":3163,"end":3199,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":0,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 278f5472ae86d..98a7f00576684 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 @@ -41,6 +41,7 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/2/second-output.d.ts] file changed its modified time //// [/src/2/second-output.d.ts.map] {"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../first/first_PART1.ts","../first/first_part3.ts","../second/second_part1.ts","../second/second_part2.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;AAED,cAAM,OAAO;;IAEK,IAAI,EAAE,MAAM,CAAC;IACb,MAAM;IACN,IAAI,CAAC,IACM,MAAM,CADK;IACtB,IAAI,CAAC,CAAC,KAAK,MAAM,EAAK;CACvC;AACD,kBAAU,OAAO,CAAC;IACA,MAAa,CAAC;KAAI;IAClB,SAAgB,GAAG,SAAK;IACxB,UAAiB,aAAa,CAAC;QAAE,MAAa,CAAC;SAAG;KAAE;IACpD,UAAiB,SAAS,CAAC,SAAS,CAAC;QAAE,MAAa,SAAS;SAAG;KAAE;IAClE,MAAM,QAAQ,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC;IAC3C,KAAY,YAAY,GAAG,SAAS,CAAC;IAC9B,MAAM,aAAa,KAAK,CAAC;IAChC,KAAY,YAAY;QAAG,CAAC,IAAA;QAAE,CAAC,IAAA;QAAE,CAAC,IAAA;KAAE;CACrD;AACa,cAAM,SAAS;CAAG;AAClB,iBAAS,WAAW,SAAK;AACzB,kBAAU,iBAAiB,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AACzD,kBAAU,aAAa,CAAC,SAAS,CAAC;IAAE,MAAa,SAAS;KAAG;CAAE;AAC/D,OAAO,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC;AACpD,aAAK,YAAY,GAAG,SAAS,CAAC;AAC9B,QAAA,MAAM,aAAa,KAAK,CAAC;AACzB,aAAK,YAAY;IAAG,CAAC,IAAA;IAAE,CAAC,IAAA;IAAE,CAAC,IAAA;CAAE;ACpC3C,cAAM,CAAC;IACH,WAAW;CAGd"} @@ -852,6 +853,8 @@ sourceFile:../second/second_part2.ts --- >>>//# sourceMappingURL=second-output.d.ts.map +//// [/src/2/second-output.js] file changed its modified time +//// [/src/2/second-output.js.map] file changed its modified time //// [/src/2/second-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../second","sourceFiles":["../second/second_part1.ts","../second/second_part2.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3527,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":234,"kind":"text"},{"pos":234,"end":339,"kind":"internal"},{"pos":341,"end":373,"kind":"text"},{"pos":373,"end":765,"kind":"internal"},{"pos":767,"end":770,"kind":"text"},{"pos":770,"end":1183,"kind":"internal"},{"pos":1185,"end":1233,"kind":"text"}]}},"version":"FakeTSVersion"} @@ -1817,6 +1820,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":3527,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":0,"end":3527,"kind":"text"}]},{"pos":3527,"end":3563,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":0,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 066dc1be56800..ac35dbe39677c 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 @@ -703,6 +703,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3527,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":3527,"kind":"text"}]},{"pos":3527,"end":3563,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 b57231031e946..62c0ca5e1c0e1 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 @@ -725,6 +725,8 @@ sourceFile:../../third_part1.ts --- >>>//# sourceMappingURL=third-output.d.ts.map +//// [/src/third/thirdjs/output/third-output.js] file changed its modified time +//// [/src/third/thirdjs/output/third-output.js.map] file changed its modified time //// [/src/third/thirdjs/output/third-output.tsbuildinfo] {"bundle":{"commonSourceDirectory":"../..","sourceFiles":["../../third_part1.ts"],"js":{"sections":[{"pos":0,"end":110,"kind":"prepend","data":"../../../first/bin/first-output.js","texts":[{"pos":0,"end":110,"kind":"text"}]},{"pos":110,"end":3163,"kind":"prepend","data":"../../../2/second-output.js","texts":[{"pos":110,"end":3163,"kind":"text"}]},{"pos":3163,"end":3199,"kind":"text"}]},"dts":{"sections":[{"pos":0,"end":157,"kind":"prepend","data":"../../../first/bin/first-output.d.ts","texts":[{"pos":0,"end":157,"kind":"text"}]},{"pos":157,"end":317,"kind":"prepend","data":"../../../2/second-output.d.ts","texts":[{"pos":157,"end":317,"kind":"text"}]},{"pos":317,"end":336,"kind":"text"}]}},"version":"FakeTSVersion"} 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 index 373e4317b3463..e26841631a1e6 100644 --- 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 @@ -97,3 +97,5 @@ exports.multiply = multiply; "size": 1351 } +//// [/src/logic/tsconfig.tsbuildinfo] file changed its modified time +//// [/src/tests/tsconfig.tsbuildinfo] file changed its modified time diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js index 74c2463e3a398..2c4dec3fd7a14 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js @@ -492,6 +492,7 @@ src/tests/index.ts exitCode:: ExitStatus.Success +//// [/src/core/anotherModule.d.ts] file changed its modified time //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; @@ -846,3 +847,5 @@ var someClass2 = /** @class */ (function () { "size": 1442 } +//// [/src/logic/tsconfig.tsbuildinfo] file changed its modified time +//// [/src/tests/tsconfig.tsbuildinfo] file changed its modified time diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js index 869b161fd9b67..c3206a0f47b12 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/listEmittedFiles.js @@ -417,6 +417,7 @@ TSFILE: /src/tests/tsconfig.tsbuildinfo exitCode:: ExitStatus.Success +//// [/src/core/anotherModule.d.ts] file changed its modified time //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; @@ -748,3 +749,5 @@ var someClass2 = /** @class */ (function () { "size": 1442 } +//// [/src/logic/tsconfig.tsbuildinfo] file changed its modified time +//// [/src/tests/tsconfig.tsbuildinfo] file changed its modified time diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js index c900551b6340b..9174e4e8e10da 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/listFiles.js @@ -418,6 +418,7 @@ Output:: exitCode:: ExitStatus.Success +//// [/src/core/anotherModule.d.ts] file changed its modified time //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; @@ -749,3 +750,5 @@ var someClass2 = /** @class */ (function () { "size": 1442 } +//// [/src/logic/tsconfig.tsbuildinfo] file changed its modified time +//// [/src/tests/tsconfig.tsbuildinfo] file changed its modified time diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js index fc4be2ddab92e..70d60d5a02179 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/sample.js @@ -734,6 +734,7 @@ readFiles:: { "/src/tests/index.d.ts": 1 } +//// [/src/core/anotherModule.d.ts] file changed its modified time //// [/src/core/index.d.ts] export declare const someString: string; export declare function leftPad(s: string, n: number): string; @@ -1152,6 +1153,7 @@ readFiles:: { "/src/tests/tsconfig.tsbuildinfo": 1 } +//// [/src/core/anotherModule.d.ts] file changed its modified time //// [/src/core/index.d.ts] file written with same contents //// [/src/core/index.d.ts.map] file written with same contents //// [/src/core/index.d.ts.map.baseline.txt] file written with same contents @@ -1228,6 +1230,9 @@ var someClass2 = /** @class */ (function () { "size": 1442 } +//// [/src/logic/tsconfig.tsbuildinfo] file changed its modified time +//// [/src/tests/index.d.ts] file changed its modified time +//// [/src/tests/tsconfig.tsbuildinfo] file changed its modified time Change:: when logic config changes declaration dir From 710f639a88d005413e1147712749e70acf6b64d5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 5 Apr 2022 12:39:44 -0700 Subject: [PATCH 3/3] Some renames per feedback --- src/testRunner/unittests/tsbuild/helpers.ts | 20 +++++------ src/testRunner/unittests/tsbuild/outFile.ts | 12 +++---- src/testRunner/unittests/tsbuild/sample.ts | 28 ++++++++-------- src/testRunner/unittests/tsc/helpers.ts | 37 ++++++++++++++------- 4 files changed, 55 insertions(+), 42 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 05800deaaac4f..a42a7437ddd45 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -332,23 +332,23 @@ interface Symbol { } interface VerifyIncrementalCorrectness { - scenario: TscCompile["scenario"]; - commandLineArgs: TscCompile["commandLineArgs"]; - modifyFs: TscCompile["modifyFs"]; + scenario: TestTscCompile["scenario"]; + commandLineArgs: TestTscCompile["commandLineArgs"]; + modifyFs: TestTscCompile["modifyFs"]; incrementalModifyFs: TscIncremental["modifyFs"]; tick: () => void; baseFs: vfs.FileSystem; newSys: TscCompileSystem; cleanBuildDiscrepancies: TscIncremental["cleanBuildDiscrepancies"]; } - function verifyIncrementalCorrectness(input: () => VerifyIncrementalCorrectness, index: number, subScenario: TscCompile["subScenario"]) { + function verifyIncrementalCorrectness(input: () => VerifyIncrementalCorrectness, index: number, subScenario: TestTscCompile["subScenario"]) { it(`Verify emit output file text is same when built clean for incremental scenario at:: ${index} ${subScenario}`, () => { const { scenario, commandLineArgs, cleanBuildDiscrepancies, modifyFs, incrementalModifyFs, tick, baseFs, newSys } = input(); - const sys = tscCompile({ + const sys = testTscCompile({ scenario, subScenario, fs: () => baseFs.makeReadonly(), @@ -521,7 +521,7 @@ interface Symbol { } } - export interface VerifyTsBuildInputWorker extends TscCompile { + export interface VerifyTsBuildInputWorker extends TestTscCompile { incrementalScenarios: TscIncremental[]; } function verifyTscIncrementalEditsWorker({ @@ -535,7 +535,7 @@ interface Symbol { let baseFs: vfs.FileSystem; before(() => { ({ fs: baseFs, tick } = getFsWithTime(fs())); - sys = tscCompile({ + sys = testTscCompile({ scenario, subScenario, fs: () => baseFs.makeReadonly(), @@ -571,7 +571,7 @@ interface Symbol { before(() => { Debug.assert(buildKind !== BuildKind.Initial, "Incremental edit cannot be initial compilation"); tick(); - newSys = tscCompile({ + newSys = testTscCompile({ scenario, subScenario: incrementalSubScenario || subScenario, buildKind, @@ -629,7 +629,7 @@ interface Symbol { let incrementalSys: TscCompileSystem[]; before(() => { ({ fs: baseFs, tick } = getFsWithTime(fs())); - sys = tscCompile({ + sys = testTscCompile({ scenario, subScenario, fs: () => baseFs.makeReadonly(), @@ -648,7 +648,7 @@ interface Symbol { ) => { Debug.assert(buildKind !== BuildKind.Initial, "Incremental edit cannot be initial compilation"); tick(); - (incrementalSys || (incrementalSys = [])).push(tscCompile({ + (incrementalSys || (incrementalSys = [])).push(testTscCompile({ scenario, subScenario: incrementalSubScenario || subScenario, buildKind, diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index eff6b03e93d88..b593f5aa40adb 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -136,12 +136,12 @@ namespace ts { modifyFs: fs => replaceText(fs, "/src/third/tsconfig.json", `"composite": true,`, ""), }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "outFile", subScenario: "rebuilds completely when version in tsbuildinfo doesnt match ts version", fs: getOutFileFsAfterBuild, commandLineArgs: ["--b", "/src/third", "--verbose"], - worker: sys => { + compile: sys => { // Buildinfo will have version which does not match with current ts version fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); const buildHost = createSolutionBuilderHost(sys); @@ -174,24 +174,24 @@ namespace ts { ] }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "outFile", subScenario: "builds till project specified", fs: () => outFileFs, commandLineArgs: ["--build", "/src/second/tsconfig.json"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.build("/src/second/tsconfig.json")); } }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "outFile", subScenario: "cleans till project specified", fs: getOutFileFsAfterBuild, commandLineArgs: ["--build", "--clean", "/src/second/tsconfig.json"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = ts.createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], { verbose: true }); sys.exit(builder.clean("/src/second/tsconfig.json")); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 452f0c4082f7a..d53ebd81de4ea 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -75,24 +75,24 @@ namespace ts { incrementalScenarios: noChangeOnlyRuns }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "cleans till project specified", fs: getSampleFsAfterBuild, commandLineArgs: ["--b", "/src/logic", "--clean"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.clean("/src/logic")); } }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "cleaning project in not build order doesnt throw error", fs: getSampleFsAfterBuild, commandLineArgs: ["--b", "/src/logic2", "--clean"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = createSolutionBuilder(buildHost, ["/src/third/tsconfig.json"], {}); sys.exit(builder.clean("/src/logic2")); @@ -149,12 +149,12 @@ namespace ts { ] }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "rebuilds completely when version in tsbuildinfo doesnt match ts version", fs: getSampleFsAfterBuild, commandLineArgs: ["--b", "/src/tests", "--verbose"], - worker: sys => { + compile: sys => { // Buildinfo will have version which does not match with current ts version fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); const buildHost = createSolutionBuilderHost(sys); @@ -163,7 +163,7 @@ namespace ts { } }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "does not rebuild if there is no program and bundle in the ts build info event if version doesnt match ts version", fs: () => { @@ -175,7 +175,7 @@ namespace ts { return fs; }, commandLineArgs: ["--b", "/src/tests", "--verbose"], - worker: sys => { + compile: sys => { // Buildinfo will have version which does not match with current ts version fakes.patchHostForBuildInfoWrite(sys, "FakeTSCurrentVersion"); const buildHost = createSolutionBuilderHost(sys); @@ -199,24 +199,24 @@ namespace ts { }] }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "builds till project specified", fs: () => projFs, commandLineArgs: ["--build", "/src/logic/tsconfig.json"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = createSolutionBuilder(buildHost, ["/src/tests"], {}); sys.exit(builder.build("/src/logic/tsconfig.json")); } }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "building project in not build order doesnt throw error", fs: () => projFs, commandLineArgs: ["--build", "/src/logic2/tsconfig.json"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = createSolutionBuilder(buildHost, ["/src/tests"], {}); sys.exit(builder.build("/src/logic2/tsconfig.json")); @@ -270,12 +270,12 @@ namespace ts { } }); - verifyTscCompileLike(tscCompileLike, { + verifyTscCompileLike(testTscCompileLike, { scenario: "sample1", subScenario: "building using buildReferencedProject", fs: () => projFs, commandLineArgs: ["--build", "/src/logic2/tsconfig.json"], - worker: sys => { + compile: sys => { const buildHost = createSolutionBuilderHost(sys); const builder = createSolutionBuilder(buildHost, ["/src/tests"], { verbose: true }); sys.exit(builder.buildReferences("/src/tests")); diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index de4930ebe115e..c984a76f5c9b6 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -19,7 +19,7 @@ namespace ts { }; export const noChangeOnlyRuns = [noChangeRun]; - export interface TscCompile extends TscCompileLikeBase { + export interface TestTscCompile extends TestTscCompileLikeBase { baselineSourceMap?: boolean; baselineReadFileCalls?: boolean; baselinePrograms?: boolean; @@ -62,7 +62,7 @@ namespace ts { } }; } - export interface TscCompileLikeBase extends VerifyTscCompileLike { + export interface TestTscCompileLikeBase extends VerifyTscCompileLike { buildKind?: BuildKind; // Should be defined for tsc --b modifyFs?: (fs: vfs.FileSystem) => void; @@ -70,18 +70,21 @@ namespace ts { environmentVariables?: Record; } - export interface TscCompileLike extends TscCompileLikeBase { - worker: (sys: TscCompileSystem) => void; + export interface TestTscCompileLike extends TestTscCompileLikeBase { + compile: (sys: TscCompileSystem) => void; additionalBaseline?: (sys: TscCompileSystem) => void; } - export function tscCompileLike(input: TscCompileLike) { + /** + * Initialize FS, run compile function and save baseline + */ + export function testTscCompileLike(input: TestTscCompileLike) { const initialFs = input.fs(); const inputFs = initialFs.shadow(); const { scenario, subScenario, buildKind, commandLineArgs, modifyFs, environmentVariables, - worker, additionalBaseline, + compile: worker, additionalBaseline, } = input; if (modifyFs) modifyFs(inputFs); inputFs.makeReadonly(); @@ -115,16 +118,19 @@ ${patch ? vfs.formatPatch(patch) : ""}` return sys; } - export function tscCompile(input: TscCompile) { + /** + * Initialize Fs, execute command line and save baseline + */ + export function testTscCompile(input: TestTscCompile) { let actualReadFileMap: MapLike | undefined; let getPrograms: CommandLineCallbacks["getPrograms"] | undefined; - return tscCompileLike({ + return testTscCompileLike({ ...input, - worker, + compile: commandLineCompile, additionalBaseline }); - function worker(sys: TscCompileSystem) { + function commandLineCompile(sys: TscCompileSystem) { fakes.patchHostForBuildInfoReadWrite(sys); const writtenFiles = sys.writtenFiles = new Set(); const originalWriteFile = sys.writeFile; @@ -182,6 +188,10 @@ ${patch ? vfs.formatPatch(patch) : ""}` commandLineArgs: readonly string[]; fs: () => vfs.FileSystem; } + + /** + * Verify by baselining after initializing FS and custom compile + */ export function verifyTscCompileLike(verifier: (input: T) => { baseLine: TscCompileSystem["baseLine"]; }, input: T) { describe(`tsc ${input.commandLineArgs.join(" ")} ${input.scenario}:: ${input.subScenario}`, () => { describe(input.scenario, () => { @@ -195,7 +205,10 @@ ${patch ? vfs.formatPatch(patch) : ""}` }); } - export function verifyTsc(input: TscCompile) { - verifyTscCompileLike(tscCompile, input); + /** + * Verify by baselining after initializing FS and command line compile + */ + export function verifyTsc(input: TestTscCompile) { + verifyTscCompileLike(testTscCompile, input); } }