Merge branch 'master' into tsconfigChangeDetection

This commit is contained in:
Sheetal Nandi
2019-03-19 16:54:25 -07:00
56 changed files with 2639 additions and 652 deletions

View File

@@ -168,14 +168,14 @@ namespace ts {
});
describe("can detect when and what to rebuild", () => {
function initializeWithBuild() {
function initializeWithBuild(opts?: BuildOptions) {
const fs = projFs.shadow();
const host = new fakes.SolutionBuilderHost(fs);
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
builder.buildAllProjects();
host.clearDiagnostics();
tick();
builder.resetBuildContext();
builder.resetBuildContext(opts ? { ...opts, verbose: true } : undefined);
return { fs, host, builder };
}
@@ -255,6 +255,20 @@ namespace ts {
);
});
it("rebuilds from start if --f is passed", () => {
const { host, builder } = initializeWithBuild({ force: true });
builder.buildAllProjects();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
);
});
it("rebuilds when tsconfig changes", () => {
const { fs, host, builder } = initializeWithBuild();
replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`);

View File

@@ -139,7 +139,7 @@ namespace ts.projectSystem {
assert.isTrue(false, `should not find file '${imported.path}'`);
}
catch (e) {
assert.isTrue(e.message.indexOf(`Could not find file: '${imported.path}'.`) === 0);
assert.isTrue(e.message.indexOf(`Could not find sourceFile: '${imported.path}' in ["${root.path}"].`) === 0, `Actual: ${e.message}`);
}
const f2Lookups = getLocationsForModuleLookup("f2");
callsTrackingHost.verifyCalledOnEachEntryNTimes(CalledMapsWithSingleArg.fileExists, f2Lookups, 1);