diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index e4660130be5..c01174f685b 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -374,7 +374,6 @@ namespace ts { export function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined) { if (compilerOptions.out || compilerOptions.outFile) return undefined; - if (!isIncrementalCompilation(compilerOptions)) return undefined; const buildInfoPath = getOutputPathForBuildInfo(compilerOptions); if (!buildInfoPath) return undefined; const content = readFile(buildInfoPath); @@ -658,7 +657,7 @@ namespace ts { ((typeDirectiveNames, containingFile, redirectedReference) => resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference)); const userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; - readBuilderProgram(compilerOptions, path => compilerHost.readFile(path)); + builderProgram = readBuilderProgram(compilerOptions, path => compilerHost.readFile(path)) as any as T; synchronizeProgram(); // Update the wild card directory watch diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index e9b7cdae326..c488efac4e3 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -99,13 +99,7 @@ namespace ts { // outputs ...outputFiles[project.first], ...outputFiles[project.second], - - // build info - outputFiles[project.third][ext.buildinfo], - ], - // These are first not present and later read new contents to generate third output - outputFiles[project.first][ext.buildinfo], - outputFiles[project.second][ext.buildinfo] + ] ); let dtsChangedExpectedDiagnostics: ReadonlyArray = [ @@ -131,12 +125,8 @@ namespace ts { ...outputFiles[project.first], ...outputFiles[project.second], outputFiles[project.third][ext.dts], - - // build info - outputFiles[project.third][ext.buildinfo], ], outputFiles[project.first][ext.dts], // dts changes so once read old content, and once new (to emit third) - outputFiles[project.first][ext.buildinfo], // since first build info changes ); let dtsChangedExpectedDiagnosticsDependOrdered: ReadonlyArray = [ @@ -173,8 +163,7 @@ namespace ts { ...outputFiles[project.first], ...outputFiles[project.second], ...outputFiles[project.third], - ], - outputFiles[project.first][ext.buildinfo], // since first build info changes + ] ); let dtsUnchangedExpectedDiagnosticsDependOrdered: ReadonlyArray = [ @@ -227,7 +216,6 @@ namespace ts { value.set(path, 1); } value.set(outputFiles[project.second][ext.dts], 2); // dts changes so once read old content, and once new (to emit third) - value.set(outputFiles[project.second][ext.buildinfo], 2); // since first build info changes return value; } diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index bd923c620fe..f21f994914c 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -42,7 +42,7 @@ namespace ts.tscWatch { } function checkFileEmit(actual: Map, expected: ReadonlyArray) { - assert.equal(actual.size, expected.length, `Actual: ${JSON.stringify(arrayFrom(actual.entries()))}\nExpected: ${JSON.stringify(expected)}`); + assert.equal(actual.size, expected.length, `Actual: ${JSON.stringify(arrayFrom(actual.entries()), /*replacer*/ undefined, " ")}\nExpected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`); expected.forEach(file => assert.equal(actual.get(file.path), file.content, `Emit for ${file.path}`)); } @@ -93,7 +93,8 @@ namespace ts.tscWatch { referencedMap: {}, exportedModulesMap: {}, semanticDiagnosticsPerFile: [libFile.path, file1.path, file2.path] - } + }, + version }) } ], @@ -115,7 +116,8 @@ namespace ts.tscWatch { referencedMap: {}, exportedModulesMap: {}, semanticDiagnosticsPerFile: [libFile.path, file1.path, file2.path] - } + }, + version }) } ], @@ -170,7 +172,8 @@ namespace ts.tscWatch { file1.path, file2ReuasableError ] - } + }, + version }) } ], @@ -196,7 +199,8 @@ namespace ts.tscWatch { file1.path, file2ReuasableError ] - } + }, + version }) } ], @@ -228,7 +232,8 @@ namespace ts.tscWatch { { pos: 0, end: outFile.content.length, kind: BundleFileSectionKind.Text } ] }, - } + }, + version }) } ], @@ -294,7 +299,8 @@ namespace ts.tscWatch { referencedMap: {}, exportedModulesMap: {}, semanticDiagnosticsPerFile: [libFile.path, file1.path, file2.path] - } + }, + version }) } ], @@ -315,7 +321,8 @@ namespace ts.tscWatch { referencedMap: {}, exportedModulesMap: {}, semanticDiagnosticsPerFile: [libFile.path, file1.path, file2.path] - } + }, + version }) } ], @@ -370,7 +377,8 @@ namespace ts.tscWatch { file1.path, file2ReuasableError ] - } + }, + version }) } ], @@ -395,7 +403,8 @@ namespace ts.tscWatch { file2ReuasableError, file1.path ] - } + }, + version }) } ], @@ -435,7 +444,8 @@ namespace ts.tscWatch { { pos: 0, end: outFile.content.length, kind: BundleFileSectionKind.Text } ] }, - } + }, + version }) } ],