From bafc3b7af0eadaa3eb6e37211232aa6c1c2e4fa9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 29 May 2020 13:44:06 -0700 Subject: [PATCH] Always emit tsbuild info even if there are non syntax errors in tsc --build mode --- src/compiler/tsbuildPublic.ts | 140 ++++++----- src/testRunner/unittests/tsbuild/helpers.ts | 44 +++- .../inferredTypeFromTransitiveModule.ts | 15 +- ...s-not-in-rootDir-at-the-import-location.js | 108 ++++++++ ...hange-in-signature-with-isolatedModules.js | 225 +++++++++++++++++ .../semantic-errors-with-incremental.js | 80 +++++- .../initial-build/include-only.js | 56 +++++ ...ojects-if-upstream-projects-have-errors.js | 80 ++++++ ...de-resolution-with-external-module-name.js | 49 ++++ .../demo/updates-with-bad-reference.js | 236 +++++++++++++++++- ...mit-any-files-on-error-with-incremental.js | 96 +++++-- .../when-preserveWatchOutput-is-not-used.js | 136 +++++++++- ...veWatchOutput-is-passed-on-command-line.js | 138 +++++++++- 13 files changed, 1296 insertions(+), 107 deletions(-) diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index a55712c44944b..2ec93db074294 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -699,6 +699,18 @@ namespace ts { }; } + enum BuildStep { + CreateProgram, + SyntaxDiagnostics, + SemanticDiagnostics, + Emit, + EmitBundle, + EmitBuildInfo, + BuildInvalidatedProjectOfBundle, + QueueReferencingProjects, + Done + } + function createBuildOrUpdateInvalidedProject( kind: InvalidatedProjectKind.Build | InvalidatedProjectKind.UpdateBundle, state: SolutionBuilderState, @@ -708,18 +720,7 @@ namespace ts { config: ParsedCommandLine, buildOrder: readonly ResolvedConfigFileName[], ): BuildInvalidedProject | UpdateBundleProject { - enum Step { - CreateProgram, - SyntaxDiagnostics, - SemanticDiagnostics, - Emit, - EmitBundle, - BuildInvalidatedProjectOfBundle, - QueueReferencingProjects, - Done - } - - let step = kind === InvalidatedProjectKind.Build ? Step.CreateProgram : Step.EmitBundle; + let step = kind === InvalidatedProjectKind.Build ? BuildStep.CreateProgram : BuildStep.EmitBundle; let program: T | undefined; let buildResult: BuildResultFlags | undefined; let invalidatedProjectOfBundle: BuildInvalidedProject | undefined; @@ -781,8 +782,11 @@ namespace ts { program => program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) ); } - executeSteps(Step.SemanticDiagnostics, cancellationToken); - if (step !== Step.Emit) return undefined; + executeSteps(BuildStep.SemanticDiagnostics, cancellationToken); + if (step === BuildStep.EmitBuildInfo) { + return emitBuildInfo(writeFile, cancellationToken); + } + if (step !== BuildStep.Emit) return undefined; return emit(writeFile, cancellationToken, customTransformers); }, done @@ -795,19 +799,19 @@ namespace ts { getCompilerOptions: () => config.options, getCurrentDirectory: () => state.currentDirectory, emit: (writeFile: WriteFileCallback | undefined, customTransformers: CustomTransformers | undefined) => { - if (step !== Step.EmitBundle) return invalidatedProjectOfBundle; + if (step !== BuildStep.EmitBundle) return invalidatedProjectOfBundle; return emitBundle(writeFile, customTransformers); }, done, }; function done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers) { - executeSteps(Step.Done, cancellationToken, writeFile, customTransformers); + executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action: (program: T) => U | undefined): U | undefined { - executeSteps(Step.CreateProgram); + executeSteps(BuildStep.CreateProgram); return program && action(program); } @@ -821,7 +825,7 @@ namespace ts { if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project); buildResult = BuildResultFlags.Success; - step = Step.QueueReferencingProjects; + step = BuildStep.QueueReferencingProjects; return; } @@ -831,7 +835,7 @@ namespace ts { reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config)); // Nothing to build - must be a solution file, basically buildResult = BuildResultFlags.None; - step = Step.QueueReferencingProjects; + step = BuildStep.QueueReferencingProjects; return; } @@ -854,7 +858,7 @@ namespace ts { function handleDiagnostics(diagnostics: readonly Diagnostic[], errorFlags: BuildResultFlags, errorType: string) { if (diagnostics.length) { - buildResult = buildErrors( + ({ buildResult, step } = buildErrors( state, projectPath, program, @@ -862,8 +866,7 @@ namespace ts { diagnostics, errorFlags, errorType - ); - step = Step.QueueReferencingProjects; + )); } else { step++; @@ -894,7 +897,7 @@ namespace ts { function emit(writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): EmitResult { Debug.assertIsDefined(program); - Debug.assert(step === Step.Emit); + Debug.assert(step === BuildStep.Emit); // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly program.backupState(); let declDiagnostics: Diagnostic[] | undefined; @@ -913,7 +916,7 @@ namespace ts { // Don't emit .d.ts if there are decl file errors if (declDiagnostics) { program.restoreState(); - buildResult = buildErrors( + ({ buildResult, step } = buildErrors( state, projectPath, program, @@ -921,8 +924,7 @@ namespace ts { declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file" - ); - step = Step.QueueReferencingProjects; + )); return { emitSkipped: true, diagnostics: emitResult.diagnostics @@ -967,6 +969,24 @@ namespace ts { return emitResult; } + function emitBuildInfo(writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult { + Debug.assertIsDefined(program); + Debug.assert(step === BuildStep.EmitBuildInfo); + const emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken); + if (emitResult.diagnostics.length) { + reportErrors(state, emitResult.diagnostics); + state.diagnostics.set(projectPath, [...state.diagnostics.get(projectPath)!, ...emitResult.diagnostics]); + buildResult = BuildResultFlags.EmitErrors & buildResult!; + } + + if (emitResult.emittedFiles && state.writeFileName) { + emitResult.emittedFiles.forEach(name => listEmittedFile(state, config, name)); + } + afterProgramDone(state, projectPath, program, config); + step = BuildStep.QueueReferencingProjects; + return emitResult; + } + function finishEmit( emitterDiagnostics: DiagnosticCollection, emittedOutputs: FileMap, @@ -977,7 +997,7 @@ namespace ts { ) { const emitDiagnostics = emitterDiagnostics.getDiagnostics(); if (emitDiagnostics.length) { - buildResult = buildErrors( + ({ buildResult, step } = buildErrors( state, projectPath, program, @@ -985,14 +1005,12 @@ namespace ts { emitDiagnostics, BuildResultFlags.EmitErrors, "Emit" - ); - step = Step.QueueReferencingProjects; + )); return emitDiagnostics; } if (state.writeFileName) { emittedOutputs.forEach(name => listEmittedFile(state, config, name)); - if (program) listFiles(program, state.writeFileName); } // Update time stamps for rest of the outputs @@ -1006,8 +1024,7 @@ namespace ts { oldestOutputFileName }); afterProgramDone(state, projectPath, program, config); - state.projectCompilerOptions = state.baseCompilerOptions; - step = Step.QueueReferencingProjects; + step = BuildStep.QueueReferencingProjects; buildResult = resultFlags; return emitDiagnostics; } @@ -1017,7 +1034,7 @@ namespace ts { if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project); buildResult = BuildResultFlags.Success; - step = Step.QueueReferencingProjects; + step = BuildStep.QueueReferencingProjects; return undefined; } @@ -1038,7 +1055,7 @@ namespace ts { if (isString(outputFiles)) { reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles)); - step = Step.BuildInvalidatedProjectOfBundle; + step = BuildStep.BuildInvalidatedProjectOfBundle; return invalidatedProjectOfBundle = createBuildOrUpdateInvalidedProject( InvalidatedProjectKind.Build, state, @@ -1070,44 +1087,48 @@ namespace ts { return { emitSkipped: false, diagnostics: emitDiagnostics }; } - function executeSteps(till: Step, cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers) { - while (step <= till && step < Step.Done) { + function executeSteps(till: BuildStep, cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers) { + while (step <= till && step < BuildStep.Done) { const currentStep = step; switch (step) { - case Step.CreateProgram: + case BuildStep.CreateProgram: createProgram(); break; - case Step.SyntaxDiagnostics: + case BuildStep.SyntaxDiagnostics: getSyntaxDiagnostics(cancellationToken); break; - case Step.SemanticDiagnostics: + case BuildStep.SemanticDiagnostics: getSemanticDiagnostics(cancellationToken); break; - case Step.Emit: + case BuildStep.Emit: emit(writeFile, cancellationToken, customTransformers); break; - case Step.EmitBundle: + case BuildStep.EmitBuildInfo: + emitBuildInfo(writeFile, cancellationToken); + break; + + case BuildStep.EmitBundle: emitBundle(writeFile, customTransformers); break; - case Step.BuildInvalidatedProjectOfBundle: + case BuildStep.BuildInvalidatedProjectOfBundle: Debug.checkDefined(invalidatedProjectOfBundle).done(cancellationToken); - step = Step.Done; + step = BuildStep.Done; break; - case Step.QueueReferencingProjects: + case BuildStep.QueueReferencingProjects: queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult)); step++; break; // Should never be done - case Step.Done: + case BuildStep.Done: default: - assertType(step); + assertType(step); } Debug.assert(step > currentStep); @@ -1247,23 +1268,25 @@ namespace ts { } function afterProgramDone( - { host, watch, builderPrograms }: SolutionBuilderState, + state: SolutionBuilderState, proj: ResolvedConfigFilePath, program: T | undefined, config: ParsedCommandLine ) { if (program) { - if (host.afterProgramEmitAndDiagnostics) { - host.afterProgramEmitAndDiagnostics(program); + if (program && state.writeFileName) listFiles(program, state.writeFileName); + if (state.host.afterProgramEmitAndDiagnostics) { + state.host.afterProgramEmitAndDiagnostics(program); } - if (watch) { + if (state.watch) { program.releaseProgram(); - builderPrograms.set(proj, program); + state.builderPrograms.set(proj, program); } } - else if (host.afterEmitBundle) { - host.afterEmitBundle(config); + else if (state.host.afterEmitBundle) { + state.host.afterEmitBundle(config); } + state.projectCompilerOptions = state.baseCompilerOptions; } function buildErrors( @@ -1272,16 +1295,17 @@ namespace ts { program: T | undefined, config: ParsedCommandLine, diagnostics: readonly Diagnostic[], - errorFlags: BuildResultFlags, - errorType: string + buildResult: BuildResultFlags, + errorType: string, ) { + const canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !outFile(program.getCompilerOptions()); + reportAndStoreErrors(state, resolvedPath, diagnostics); // List files if any other build error using program (emit errors already report files) - if (program && state.writeFileName) listFiles(program, state.writeFileName); state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); + if (canEmitBuildInfo) return { buildResult, step: BuildStep.EmitBuildInfo }; afterProgramDone(state, resolvedPath, program, config); - state.projectCompilerOptions = state.baseCompilerOptions; - return errorFlags; + return { buildResult, step: BuildStep.QueueReferencingProjects }; } function updateModuleResolutionCache( diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index c2bd7c5aa8a6e..410c00aa77db1 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -270,8 +270,8 @@ interface Symbol { baseFs: vfs.FileSystem; newSys: TscCompileSystem; } - function verifyIncrementalCorrectness(input: () => VerifyIncrementalCorrectness) { - it(`Verify emit output file text is same when built clean`, () => { + function verifyIncrementalCorrectness(input: () => VerifyIncrementalCorrectness, index: number) { + it(`Verify emit output file text is same when built clean for incremental scenario at:: ${index}`, () => { const { scenario, subScenario, commandLineArgs, modifyFs, incrementalModifyFs, @@ -291,11 +291,39 @@ interface Symbol { for (const outputFile of arrayFrom(sys.writtenFiles.keys())) { const expectedText = sys.readFile(outputFile); const actualText = newSys.readFile(outputFile); - assert.equal(actualText, expectedText, `File: ${outputFile}`); + if (!isBuildInfoFile(outputFile)) { + assert.equal(actualText, expectedText, `File: ${outputFile}`); + } + else if (actualText !== expectedText) { + // Verify build info without affectedFilesPendingEmit + const { text: actualBuildInfoText, affectedFilesPendingEmit: actualAffectedFilesPendingEmit } = getBuildInfoWithoutAffectedFilesPendingEmit(actualText); + const { text: expectedBuildInfoText, affectedFilesPendingEmit: expectedAffectedFilesPendingEmit } = getBuildInfoWithoutAffectedFilesPendingEmit(expectedText); + assert.equal(actualBuildInfoText, expectedBuildInfoText, `TsBuild info text without affectedFilesPendingEmit: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); + // Verify that incrementally pending affected file emit are in clean build since clean build can contain more files compared to incremental depending of noEmitOnError option + if (actualAffectedFilesPendingEmit) { + assert.isDefined(expectedAffectedFilesPendingEmit, `Incremental build contains affectedFilesPendingEmit, clean build should also have it: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); + for (const actual of actualAffectedFilesPendingEmit) { + assert.isTrue(contains(expectedAffectedFilesPendingEmit, actual, ([file1], [file2]) => file1 === file2), `Incremental build contains ${actual[0]} file as pending emit, clean build should also have it: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); + } + } + } } }); } + function getBuildInfoWithoutAffectedFilesPendingEmit(text: string | undefined): { text: string | undefined; affectedFilesPendingEmit?: ProgramBuildInfo["affectedFilesPendingEmit"]; } { + const buildInfo = text ? getBuildInfo(text) : undefined; + if (!buildInfo?.program?.affectedFilesPendingEmit) return { text }; + const { program: { affectedFilesPendingEmit, ...programRest }, ...rest } = buildInfo; + return { + text: getBuildInfoText({ + ...rest, + program: programRest + }), + affectedFilesPendingEmit + }; + } + export interface TscIncremental { buildKind: BuildKind; modifyFs: (fs: vfs.FileSystem) => void; @@ -356,12 +384,12 @@ interface Symbol { verifyTscBaseline(() => sys); }); - for (const { + incrementalScenarios.forEach(({ buildKind, modifyFs: incrementalModifyFs, subScenario: incrementalSubScenario, commandLineArgs: incrementalCommandLineArgs - } of incrementalScenarios) { + }, index) => { describe(incrementalSubScenario || buildKind, () => { let newSys: TscCompileSystem; before(() => { @@ -396,9 +424,9 @@ interface Symbol { incrementalModifyFs, modifyFs, tick - })); + }), index); }); - } + }); }); } @@ -496,7 +524,7 @@ interface Symbol { }, modifyFs, tick - }))); + }), index)); }); }); } diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index f5037f304cef0..eccd6e41aeb1a 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -42,10 +42,17 @@ namespace ts { import { default as bar } from './bar'; bar("hello");`); }, - incrementalScenarios: [{ - buildKind: BuildKind.IncrementalDtsChange, - modifyFs: changeBarParam - }] + incrementalScenarios: [ + { + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: changeBarParam + }, + { + subScenario: "Fix Error", + buildKind: BuildKind.IncrementalDtsChange, + modifyFs: fs => replaceText(fs, "/src/lazyIndex.ts", `bar("hello")`, "bar()") + }, + ] }); }); diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js index e70f1f9d5aa39..1efc8bd513b74 100644 --- a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js @@ -197,3 +197,111 @@ Found 7 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +//// [/src/lib/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "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": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n", + "affectsGlobalScope": false + }, + "../../animals/dog.ts": { + "version": "-10991948013-import Animal from '.';\r\nimport { makeRandomName } from '../core/utilities';\r\n\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\n\r\nexport function createDog(): Dog {\r\n return ({\r\n size: \"medium\",\r\n woof: function(this: Dog) {\r\n console.log(`${this.name} says \"Woof\"!`);\r\n },\r\n name: makeRandomName()\r\n });\r\n}\r\n\r\n", + "signature": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n", + "affectsGlobalScope": false + }, + "../../animals/index.ts": { + "version": "-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n", + "signature": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n", + "affectsGlobalScope": false + }, + "../../core/utilities.ts": { + "version": "-15713992787-import * as A from '../animals';\n\r\nexport function makeRandomName() {\r\n return \"Bob!?! \";\r\n}\r\n\r\nexport function lastElementOf(arr: T[]): T | undefined {\r\n if (arr.length === 0) return undefined;\r\n return arr[arr.length - 1];\r\n}\r\n\r\n", + "signature": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf(arr: T[]): T | undefined;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../core", + "configFilePath": "../../core/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ], + "../../core/utilities.ts": [ + "../../animals/index.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + [ + "../../core/utilities.ts", + [ + { + "file": "../../core/utilities.ts", + "start": 0, + "length": 32, + "messageText": "'A' is declared but its value is never read.", + "category": 1, + "code": 6133, + "reportsUnnecessary": true + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "../../animals/animal.ts", + 1 + ], + [ + "../../animals/dog.ts", + 1 + ], + [ + "../../animals/index.ts", + 1 + ], + [ + "../../core/utilities.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js index abc2adbd836a1..0095d18fa5252 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-build/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -264,3 +264,228 @@ Found 1 error. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +//// [/src/obj/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../bar.ts": { + "version": "747071916-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(): void {\r\n});", + "signature": "-9232740537-declare const _default: () => void;\r\nexport default _default;\r\n", + "affectsGlobalScope": false + }, + "../bundling.ts": { + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n", + "affectsGlobalScope": false + }, + "../global.d.ts": { + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "affectsGlobalScope": true + }, + "../lazyindex.ts": { + "version": "3017320451-export { default as bar } from './bar';\n\nimport { default as bar } from './bar';\nbar(\"hello\");", + "signature": "-6224542381-export { default as bar } from './bar';\r\n", + "affectsGlobalScope": false + }, + "../index.ts": { + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "6256067474-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<() => void, typeof import(\"./lazyIndex\")>;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "target": 1, + "declaration": true, + "outDir": "./", + "incremental": true, + "isolatedModules": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../bar.ts", + "../bundling.ts", + "../global.d.ts", + "../index.ts", + [ + "../lazyindex.ts", + [ + { + "file": "../lazyindex.ts", + "start": 85, + "length": 7, + "messageText": "Expected 0 arguments, but got 1.", + "category": 1, + "code": 2554 + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "../lazyindex.ts", + 0 + ], + [ + "../index.ts", + 0 + ], + [ + "../bar.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Fix Error +Input:: +//// [/src/lazyIndex.ts] +export { default as bar } from './bar'; + +import { default as bar } from './bar'; +bar(); + + + +Output:: +/lib/tsc --b /src --verbose +[12:07:00 AM] Projects in this build: + * src/tsconfig.json + +[12:07:00 AM] Project 'src/tsconfig.json' is out of date because oldest output 'src/obj/bar.js' is older than newest input 'src/lazyIndex.ts' + +[12:07:00 AM] Building project '/src/tsconfig.json'... + +[12:07:00 AM] Updating unchanged output timestamps of project '/src/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/obj/bar.d.ts] +declare const _default: () => void; +export default _default; + + +//// [/src/obj/bar.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = foo()(function foobar() { +}); + + +//// [/src/obj/index.d.ts] +import { LazyAction } from './bundling'; +export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex")>; + + +//// [/src/obj/lazyIndex.d.ts] file written with same contents +//// [/src/obj/lazyIndex.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var bar_1 = require("./bar"); +Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } }); +var bar_2 = require("./bar"); +bar_2.default(); + + +//// [/src/obj/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../bar.ts": { + "version": "747071916-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(): void {\r\n});", + "signature": "-9232740537-declare const _default: () => void;\r\nexport default _default;\r\n", + "affectsGlobalScope": false + }, + "../bundling.ts": { + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n", + "affectsGlobalScope": false + }, + "../global.d.ts": { + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "affectsGlobalScope": true + }, + "../lazyindex.ts": { + "version": "-3721262293-export { default as bar } from './bar';\n\nimport { default as bar } from './bar';\nbar();", + "signature": "-6224542381-export { default as bar } from './bar';\r\n", + "affectsGlobalScope": false + }, + "../index.ts": { + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "6256067474-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<() => void, typeof import(\"./lazyIndex\")>;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "target": 1, + "declaration": true, + "outDir": "./", + "incremental": true, + "isolatedModules": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "exportedModulesMap": { + "../index.ts": [ + "../bundling.ts", + "../lazyindex.ts" + ], + "../lazyindex.ts": [ + "../bar.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../bar.ts", + "../bundling.ts", + "../global.d.ts", + "../index.ts", + "../lazyindex.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/semantic-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/semantic-errors-with-incremental.js index 091e9d94ba8bb..807e97f2c3cf3 100644 --- a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/semantic-errors-with-incremental.js +++ b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/semantic-errors-with-incremental.js @@ -64,6 +64,79 @@ Semantic diagnostics in builder refreshed for:: /src/src/other.ts +//// [/src/dev-build/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../shared/types/db.ts": { + "version": "-9621097780-export interface A {\r\n name: string;\r\n}", + "signature": "-6245214333-export interface A {\r\n name: string;\r\n}\r\n", + "affectsGlobalScope": false + }, + "../src/main.ts": { + "version": "-11111345725-import { A } from \"../shared/types/db\";\nconst a: string = 10;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "../src/other.ts": { + "version": "11373096570-console.log(\"hi\");\r\nexport { }", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "outDir": "./", + "noEmitOnError": true, + "incremental": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../src/main.ts": [ + "../shared/types/db.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../shared/types/db.ts", + [ + "../src/main.ts", + [ + { + "file": "../src/main.ts", + "start": 46, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "../src/other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "../shared/types/db.ts", + 1 + ], + [ + "../src/main.ts", + 1 + ], + [ + "../src/other.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: no-change-run @@ -90,10 +163,6 @@ Program files:: /src/src/other.ts Semantic diagnostics in builder refreshed for:: -/lib/lib.d.ts -/src/shared/types/db.ts -/src/src/main.ts -/src/src/other.ts @@ -118,10 +187,7 @@ Program files:: /src/src/other.ts Semantic diagnostics in builder refreshed for:: -/lib/lib.d.ts -/src/shared/types/db.ts /src/src/main.ts -/src/src/other.ts //// [/src/dev-build/shared/types/db.js] diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js index e1d0659797c0f..408fd4c55240c 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js @@ -65,3 +65,59 @@ Found 1 error. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +//// [/src/dist/tsconfig_withInclude.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../src/hello.json": { + "version": "6651571919-{\n \"hello\": \"world\"\n}", + "signature": "-4341462827-export declare const hello: string;\r\n", + "affectsGlobalScope": true + }, + "../src/index.ts": { + "version": "-27703454282-import hello from \"./hello.json\"\n\nexport default hello.hello", + "signature": "-1680156224-declare const _default: string;\r\nexport default _default;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "module": 1, + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "./", + "skipDefaultLibCheck": true, + "configFilePath": "../tsconfig_withInclude.json" + }, + "referencedMap": { + "../src/index.ts": [ + "../src/hello.json" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../src/hello.json", + "../src/index.ts" + ], + "affectedFilesPendingEmit": [ + [ + "../src/hello.json", + 1 + ], + [ + "../src/index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js index 20dc07826060f..b5f79e477c0fc 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/does-not-build-downstream-projects-if-upstream-projects-have-errors.js @@ -196,3 +196,83 @@ exports.multiply = multiply; "version": "FakeTSVersion" } +//// [/src/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-6409874073-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.muitply();\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-4761685354-export declare function getSecondsInDay(): any;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + [ + "./index.ts", + [ + { + "file": "./index.ts", + "start": 87, + "length": 7, + "code": 2339, + "category": 1, + "messageText": "Property 'muitply' does not exist on type 'typeof import(\"/src/core/index\")'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "../core/index.d.ts", + 1 + ], + [ + "../core/anothermodule.d.ts", + 1 + ], + [ + "./index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js index 10a5f43474c07..1bc69c6c72629 100644 --- a/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js +++ b/tests/baselines/reference/tsbuild/transitiveReferences/initial-build/reports-error-about-module-not-found-with-node-resolution-with-external-module-name.js @@ -114,3 +114,52 @@ exports.A = A; "version": "FakeTSVersion" } +//// [/src/tsconfig.b.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./b.ts": { + "version": "-17186364832-import {A} from 'a';\nexport const b = new A();", + "signature": "-6598996556-export declare const b: any;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "moduleResolution": 2, + "listFiles": true, + "configFilePath": "./tsconfig.b.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + [ + "./b.ts", + [ + { + "file": "./b.ts", + "start": 16, + "length": 3, + "messageText": "Cannot find module 'a' or its corresponding type declarations.", + "category": 1, + "code": 2307 + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./b.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js index a22633150842a..d13fc00f24828 100644 --- a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js +++ b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js @@ -204,19 +204,19 @@ Output::    ~~~~~~~~~~~~ -[12:00:50 AM] Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors +[12:00:57 AM] Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors -[12:00:51 AM] Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors +[12:00:58 AM] Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors -[12:00:52 AM] Project 'zoo/tsconfig.json' can't be built because its dependency 'animals' was not built +[12:00:59 AM] Project 'zoo/tsconfig.json' can't be built because its dependency 'animals' was not built -[12:00:53 AM] Skipping build of project '/user/username/projects/demo/zoo/tsconfig.json' because its dependency '/user/username/projects/demo/animals' was not built +[12:01:00 AM] Skipping build of project '/user/username/projects/demo/zoo/tsconfig.json' because its dependency '/user/username/projects/demo/animals' was not built -[12:00:54 AM] Found 7 errors. Watching for file changes. +[12:01:01 AM] Found 7 errors. Watching for file changes. @@ -268,6 +268,115 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/demo/lib/core/tsconfig.tsbuildinfo] +{ + "program": { + "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": "-10510161654-export declare type Size = \"small\" | \"medium\" | \"large\";\nexport default interface Animal {\n size: Size;\n}\n", + "affectsGlobalScope": false + }, + "../../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", + "affectsGlobalScope": false + }, + "../../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", + "affectsGlobalScope": false + }, + "../../core/utilities.ts": { + "version": "-15713992787-import * as A from '../animals';\n\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", + "affectsGlobalScope": false + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../core", + "watch": true, + "configFilePath": "../../core/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ], + "../../core/utilities.ts": [ + "../../animals/index.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", + [ + { + "file": "../../core/utilities.ts", + "start": 0, + "length": 32, + "messageText": "'A' is declared but its value is never read.", + "category": 1, + "code": 6133, + "reportsUnnecessary": true + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "../../animals/animal.ts", + 1 + ], + [ + "../../animals/dog.ts", + 1 + ], + [ + "../../animals/index.ts", + 1 + ], + [ + "../../core/utilities.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: Prepend a line @@ -290,13 +399,13 @@ export function lastElementOf(arr: T[]): T | undefined { Output:: >> Screen clear -[12:00:58 AM] File change detected. Starting incremental compilation... +[12:01:05 AM] File change detected. Starting incremental compilation... -[12:00:59 AM] Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist +[12:01:06 AM] Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist -[12:01:00 AM] Building project '/user/username/projects/demo/core/tsconfig.json'... +[12:01:07 AM] Building project '/user/username/projects/demo/core/tsconfig.json'... animals/index.ts:1:20 - error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. @@ -341,7 +450,7 @@ Output::    ~~~~~~~~~~~~ -[12:01:01 AM] Found 7 errors. Watching for file changes. +[12:01:11 AM] Found 7 errors. Watching for file changes. @@ -389,3 +498,112 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/demo/lib/core/tsconfig.tsbuildinfo] +{ + "program": { + "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": "-10510161654-export declare type Size = \"small\" | \"medium\" | \"large\";\nexport default interface Animal {\n size: Size;\n}\n", + "affectsGlobalScope": false + }, + "../../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", + "affectsGlobalScope": false + }, + "../../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", + "affectsGlobalScope": false + }, + "../../core/utilities.ts": { + "version": "-10926881769-\nimport * as A from '../animals';\n\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", + "affectsGlobalScope": false + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../core", + "watch": true, + "configFilePath": "../../core/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../../core/utilities.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ], + "../../core/utilities.ts": [ + "../../animals/index.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", + [ + { + "file": "../../core/utilities.ts", + "start": 1, + "length": 32, + "messageText": "'A' is declared but its value is never read.", + "category": 1, + "code": 6133, + "reportsUnnecessary": true + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "../../animals/animal.ts", + 1 + ], + [ + "../../animals/dog.ts", + 1 + ], + [ + "../../animals/index.ts", + 1 + ], + [ + "../../core/utilities.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js index 49d3e41dac119..8d493f6a20fb8 100644 --- a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js +++ b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js @@ -309,7 +309,7 @@ Output::    ~ -[12:01:14 AM] Found 1 error. Watching for file changes. +[12:01:17 AM] Found 1 error. Watching for file changes. @@ -342,6 +342,72 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/noEmitOnError/dev-build/tsconfig.tsbuildinfo] +{ + "program": { + "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 + }, + "../shared/types/db.ts": { + "version": "-9621097780-export interface A {\r\n name: string;\r\n}", + "signature": "-5014788164-export interface A {\n name: string;\n}\n", + "affectsGlobalScope": false + }, + "../src/main.ts": { + "version": "-11111345725-import { A } from \"../shared/types/db\";\nconst a: string = 10;", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "../src/other.ts": { + "version": "11373096570-console.log(\"hi\");\r\nexport { }", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + } + }, + "options": { + "outDir": "./", + "noEmitOnError": true, + "watch": true, + "incremental": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../src/main.ts": [ + "../shared/types/db.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../shared/types/db.ts", + [ + "../src/main.ts", + [ + { + "file": "../src/main.ts", + "start": 46, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ], + "../src/other.ts" + ], + "affectedFilesPendingEmit": [ + [ + "../src/main.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No change @@ -350,13 +416,13 @@ Input:: Output:: >> Screen clear -[12:01:18 AM] File change detected. Starting incremental compilation... +[12:01:21 AM] File change detected. Starting incremental compilation... -[12:01:19 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' +[12:01:22 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' -[12:01:20 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... +[12:01:23 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... src/main.ts:2:7 - error TS2322: Type 'number' is not assignable to type 'string'. @@ -365,7 +431,7 @@ Output::    ~ -[12:01:21 AM] Found 1 error. Watching for file changes. +[12:01:24 AM] Found 1 error. Watching for file changes. @@ -408,19 +474,19 @@ const a: string = "hello"; Output:: >> Screen clear -[12:01:25 AM] File change detected. Starting incremental compilation... +[12:01:28 AM] File change detected. Starting incremental compilation... -[12:01:26 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' +[12:01:29 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' -[12:01:27 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... +[12:01:30 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... -[12:01:35 AM] Updating unchanged output timestamps of project '/user/username/projects/noEmitOnError/tsconfig.json'... +[12:01:38 AM] Updating unchanged output timestamps of project '/user/username/projects/noEmitOnError/tsconfig.json'... -[12:01:36 AM] Found 0 errors. Watching for file changes. +[12:01:39 AM] Found 0 errors. Watching for file changes. @@ -517,19 +583,19 @@ Input:: Output:: >> Screen clear -[12:01:40 AM] File change detected. Starting incremental compilation... +[12:01:43 AM] File change detected. Starting incremental compilation... -[12:01:41 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' +[12:01:44 AM] Project 'tsconfig.json' is out of date because oldest output 'dev-build/shared/types/db.js' is older than newest input 'src/main.ts' -[12:01:42 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... +[12:01:45 AM] Building project '/user/username/projects/noEmitOnError/tsconfig.json'... -[12:01:44 AM] Updating unchanged output timestamps of project '/user/username/projects/noEmitOnError/tsconfig.json'... +[12:01:47 AM] Updating unchanged output timestamps of project '/user/username/projects/noEmitOnError/tsconfig.json'... -[12:01:45 AM] Found 0 errors. Watching for file changes. +[12:01:48 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js index bc2e4ee3c41c9..ab23323603329 100644 --- a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js @@ -440,7 +440,7 @@ Output::    ~ -[12:01:19 AM] Found 1 error. Watching for file changes. +[12:01:22 AM] Found 1 error. Watching for file changes. @@ -481,6 +481,79 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "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", + "affectsGlobalScope": false + }, + "../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", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-5445152744-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\nlet y: string = 10;", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + [ + "./index.ts", + [ + { + "file": "./index.ts", + "start": 184, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: change core @@ -495,7 +568,7 @@ let x: string = 10; Output:: >> Screen clear -[12:01:23 AM] File change detected. Starting incremental compilation... +[12:01:26 AM] File change detected. Starting incremental compilation... sample1/core/index.ts:5:5 - error TS2322: Type 'number' is not assignable to type 'string'. @@ -510,7 +583,7 @@ Output::    ~ -[12:01:24 AM] Found 2 errors. Watching for file changes. +[12:01:30 AM] Found 2 errors. Watching for file changes. @@ -550,3 +623,60 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "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": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-17094159457-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\nlet x: string = 10;", + "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", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + [ + "./index.ts", + [ + { + "file": "./index.ts", + "start": 186, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js index 093a9c384ccd0..1cabdaa6df77d 100644 --- a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js @@ -441,7 +441,7 @@ Output::    ~ -[12:01:19 AM] Found 1 error. Watching for file changes. +[12:01:22 AM] Found 1 error. Watching for file changes. @@ -482,6 +482,80 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "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", + "affectsGlobalScope": false + }, + "../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", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-5445152744-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\nlet y: string = 10;", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "preserveWatchOutput": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + [ + "./index.ts", + [ + { + "file": "./index.ts", + "start": 184, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: change core @@ -495,7 +569,7 @@ let x: string = 10; Output:: -[12:01:23 AM] File change detected. Starting incremental compilation... +[12:01:26 AM] File change detected. Starting incremental compilation... sample1/core/index.ts:5:5 - error TS2322: Type 'number' is not assignable to type 'string'. @@ -510,7 +584,7 @@ Output::    ~ -[12:01:24 AM] Found 2 errors. Watching for file changes. +[12:01:30 AM] Found 2 errors. Watching for file changes. @@ -550,3 +624,61 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "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": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-17094159457-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\nlet x: string = 10;", + "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", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "preserveWatchOutput": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + [ + "./index.ts", + [ + { + "file": "./index.ts", + "start": 186, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type 'number' is not assignable to type 'string'." + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./index.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} +