Merge pull request #18958 from Microsoft/compilePublicApi

Compile public api so that all the updates are ensured to be correct
This commit is contained in:
Sheetal Nandi 2017-10-04 18:16:51 -07:00 committed by GitHub
commit c02865f357
3 changed files with 31 additions and 7 deletions

View File

@ -1,10 +1,34 @@
/// <reference path="../harness.ts" />
describe("Public APIs", () => {
it("for the language service and compiler should be acknowledged when they change", () => {
Harness.Baseline.runBaseline("api/typescript.d.ts", () => Harness.IO.readFile("built/local/typescript.d.ts"));
function verifyApi(fileName: string) {
const builtFile = `built/local/${fileName}`;
const api = `api/${fileName}`;
let fileContent: string;
before(() => {
fileContent = Harness.IO.readFile(builtFile);
});
it("should be acknowledged when they change", () => {
Harness.Baseline.runBaseline(api, () => fileContent);
});
it("should compile", () => {
const testFile: Harness.Compiler.TestFile = {
unitName: builtFile,
content: fileContent
};
const inputFiles = [testFile];
const output = Harness.Compiler.compileFiles(inputFiles, [], /*harnessSettings*/ undefined, /*options*/ {}, /*currentDirectory*/ undefined);
assert(!output.result.errors || !output.result.errors.length, Harness.Compiler.minimalDiagnosticsToString(output.result.errors, /*pretty*/ true));
});
}
describe("for the language service and compiler", () => {
verifyApi("typescript.d.ts");
});
it("for the language server should be acknowledged when they change", () => {
Harness.Baseline.runBaseline("api/tsserverlibrary.d.ts", () => Harness.IO.readFile("built/local/tsserverlibrary.d.ts"));
describe("for the language server", () => {
verifyApi("tsserverlibrary.d.ts");
});
});
});

View File

@ -296,7 +296,7 @@ namespace ts.server {
}
}
getCancellationToken() {
getCancellationToken(): HostCancellationToken {
return this.cancellationToken;
}

View File

@ -7104,7 +7104,7 @@ declare namespace ts.server {
getScriptKind(fileName: string): ScriptKind;
getScriptVersion(filename: string): string;
getScriptSnapshot(filename: string): IScriptSnapshot;
getCancellationToken(): ThrottledCancellationToken;
getCancellationToken(): HostCancellationToken;
getCurrentDirectory(): string;
getDefaultLibFileName(): string;
useCaseSensitiveFileNames(): boolean;